Esempio n. 1
0
    function widget($args, $instance)
    {
        $cache = wp_cache_get('mtheme_popular_posts', 'widget');
        if (!is_array($cache)) {
            $cache = array();
        }
        if (isset($cache[$args['widget_id']])) {
            echo $cache[$args['widget_id']];
            return;
        }
        ob_start();
        extract($args);
        $title = apply_filters('widget_title', empty($instance['title']) ? __('Popular Posts', 'mthemelocal') : $instance['title'], $instance, $this->id_base);
        if (!($number = (int) $instance['number'])) {
            $number = 10;
        } else {
            if ($number < 1) {
                $number = 1;
            } else {
                if ($number > 15) {
                    $number = 15;
                }
            }
        }
        if (!($desc_length = (int) $instance['desc_length'])) {
            $desc_length = 80;
        } else {
            if ($desc_length < 1) {
                $desc_length = 1;
            }
        }
        $disable_thumbnail = $instance['disable_thumbnail'] ? '1' : '0';
        $display_extra_type = $instance['display_extra_type'] ? $instance['display_extra_type'] : 'time';
        $query = array('showposts' => $number, 'nopaging' => 0, 'orderby' => 'comment_count', 'post_status' => 'publish', 'ignore_sticky_posts' => 1);
        if (!empty($instance['cat'])) {
            $query['cat'] = implode(',', $instance['cat']);
        }
        $r = new WP_Query($query);
        if ($r->have_posts()) {
            ?>
		<?php 
            echo $before_widget;
            ?>
		<?php 
            if ($title) {
                echo $before_title . $title . $after_title;
            }
            ?>
		<ul id="popularposts_list">
<?php 
            while ($r->have_posts()) {
                $r->the_post();
                ?>
			<li>
<?php 
                if (!$disable_thumbnail) {
                    ?>
				<a class="popular_thumbnail" href="<?php 
                    echo get_permalink();
                    ?>
" title="<?php 
                    the_title();
                    ?>
">
<?php 
                    if (has_post_thumbnail()) {
                        ?>

		<?php 
                        // Show Image
                        echo mtheme_display_post_image(get_the_ID(), $have_image_url = false, $link = false, $type = "gridblock-tiny", $the_post_title = "", $class = "");
                        ?>
		
<?php 
                    } else {
                        ?>
					<img src="<?php 
                        echo MTHEME_PATH;
                        ?>
/images/icons/post_thumbnail.png" width="75" height="75" title="<?php 
                        the_title();
                        ?>
" alt="<?php 
                        the_title();
                        ?>
"/>
<?php 
                    }
                    //end has_post_thumbnail
                    ?>
				</a>
<?php 
                }
                //disable_thumbnail
                ?>
				<div class="popularpost_info">
					<a class="popularpost_title" href="<?php 
                the_permalink();
                ?>
" rel="bookmark" title="<?php 
                echo esc_attr(get_the_title() ? get_the_title() : get_the_ID());
                ?>
"><?php 
                if (get_the_title()) {
                    the_title();
                } else {
                    the_ID();
                }
                ?>
</a>

					<p><?php 
                echo wp_html_excerpt(get_the_excerpt(), $desc_length);
                ?>
..</p>

				</div>
				<div class="clear"></div>
			</li>
<?php 
            }
            ?>
		</ul>
		<?php 
            echo $after_widget;
            // Reset the global $the_post as this query will have stomped on it
            wp_reset_query();
        }
        $cache[$args['widget_id']] = ob_get_flush();
        wp_cache_set('mtheme_popular_posts', $cache, 'widget');
    }
Esempio n. 2
0
    function widget($args, $instance)
    {
        extract($args, EXTR_SKIP);
        $clickaction = "";
        $thepage = "";
        $thecategory = "";
        $listchoice = "";
        $galleryorder = "";
        $thumbsize = "";
        $thelimit = -1;
        $columnbreak = "3";
        $height = 82;
        $width = 82;
        $gridtype = "infobar-portfoliogrid";
        if (isset($instance['clickaction'])) {
            $clickaction = $instance['clickaction'];
        }
        if (isset($instance['thepage'])) {
            $thepage = $instance['thepage'];
        }
        if (isset($instance['thecategory'])) {
            $thecategory = $instance['thecategory'];
        }
        if (isset($instance['theportfolio'])) {
            $theportfolio = $instance['theportfolio'];
        }
        if (isset($instance['listchoice'])) {
            $listchoice = $instance['listchoice'];
        }
        if (isset($instance['thelimit'])) {
            $thelimit = $instance['thelimit'];
        }
        if (isset($instance['galleryorder'])) {
            $galleryorder = $instance['galleryorder'];
        }
        if (isset($instance['thumbsize'])) {
            $thumbsize = $instance['thumbsize'];
        }
        echo $before_widget;
        $title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']);
        if (!empty($title)) {
            echo $before_title . $title . $after_title;
        }
        $gridtype = "infobar-portfoliogrid";
        $quality = MTHEME_IMAGE_QUALITY;
        $count = 0;
        $vkey = "video";
        ?>
			
			<div>
			<ul class="<?php 
        echo $gridtype;
        ?>
">
			
			<?php 
        switch ($listchoice) {
            case "portfolio":
                global $post;
                if ($theportfolio == "BLANK") {
                    $theportfolio = "";
                }
                $newquery = array('post_type' => 'mtheme_portfolio', 'types' => $theportfolio, 'orderby' => 'menu_order', 'order' => 'ASC', 'posts_per_page' => $thelimit);
                query_posts($newquery);
                if (have_posts()) {
                    while (have_posts()) {
                        the_post();
                        $count++;
                        $image_id = get_post_thumbnail_id($post->ID, 'fullpage');
                        $image_url = wp_get_attachment_image_src($image_id, 'fullpage');
                        $image_url = $image_url[0];
                        $thumbnail_image_id = get_post_thumbnail_id($post->ID, 'gridblock-tiny');
                        $thumbnail_image_url = wp_get_attachment_image_src($image_id, 'gridblock-tiny');
                        $thumbnail_image_url = $thumbnail_image_url[0];
                        $imageTitle = get_the_title($post->ID);
                        $video = get_post_meta($post->ID, $vkey, true);
                        $hovericon = "imageicon";
                        $lightbox_url = $image_url;
                        if ($video != "") {
                            $hovericon = "videoicon";
                            $lightbox_url = $video;
                        }
                        if ($count == $columnbreak) {
                            $class_string = $hovericon;
                            $count = 0;
                        } else {
                            $class_string = "rightspace " . $hovericon;
                        }
                        ?>

						<li class="<?php 
                        echo $class_string;
                        ?>
">
						<?php 
                        if ($clickaction == "lightbox" && !post_password_required()) {
                            ?>
							<a rel="prettyPhoto[<?php 
                            echo $args['widget_id'];
                            ?>
]" href="<?php 
                            echo $lightbox_url;
                            ?>
" title="<?php 
                            echo $imageTitle;
                            ?>
">
							<?php 
                        } else {
                            ?>
							<a href="<?php 
                            the_permalink();
                            ?>
">
							<?php 
                        }
                        ?>
								<?php 
                        if (post_password_required()) {
                            $have_image_url = get_template_directory_uri() . '/images/icons/post_locked.png';
                        } else {
                            $have_image_url = $thumbnail_image_url;
                        }
                        echo mtheme_display_post_image($post->ID, $have_image_url, $link = false, $type = "", $post->post_title, $class = "sidegalleryfade");
                        ?>
							</a>
						</li>			
					
					<?php 
                    }
                }
                break;
                // If the choice is Pages
            // If the choice is Pages
            case "page":
                $filter_image_ids = mtheme_get_custom_attachments($thepage);
                $page_title = get_the_title($thepage);
                $page_link = get_page_link($thepage);
                foreach ($filter_image_ids as $attatchmentID) {
                    $imagearray = wp_get_attachment_image_src($attatchmentID, 'fullsize', false);
                    $imageURI = $imagearray[0];
                    $thumbnail_imagearray = wp_get_attachment_image_src($attatchmentID, 'gridblock-tiny', false);
                    $thumbnail_imageURI = $thumbnail_imagearray[0];
                    $imageID = get_post($attatchmentID);
                    $imageTitle = apply_filters('the_title', $imageID->post_title);
                    $postlink = get_permalink($imageID->post_parent);
                    $attatchmentURL = get_attachment_link($imageID->ID);
                    $count++;
                    if ($count == $columnbreak) {
                        $class_string = "imageicon";
                        $count = 0;
                    } else {
                        $class_string = "rightspace imageicon";
                    }
                    ?>

						<li class="<?php 
                    echo $class_string;
                    ?>
">
						<?php 
                    if ($clickaction == "lightbox") {
                        ?>
							<a rel="prettyPhoto[<?php 
                        echo $args['widget_id'];
                        ?>
]" href="<?php 
                        echo $imageURI;
                        ?>
">
							<?php 
                    } else {
                        ?>
							<a href="<?php 
                        echo $attatchmentURL;
                        ?>
">
							<?php 
                    }
                    ?>
								<?php 
                    echo mtheme_display_post_image(get_the_ID(), $have_image_url = $thumbnail_imageURI, $link = false, $type = "", $imageTitle, $class = "sidegalleryfade");
                    ?>
							</a>
						</li>
							<?php 
                }
                break;
            case "category":
                // If the choice is Posts in Categories
                global $post;
                query_posts(array('cat' => $thecategory, 'showposts' => $thelimit, 'post_status' => 'publish', 'order' => 'ASC', 'orderby' => $galleryorder));
                while (have_posts()) {
                    the_post();
                    $count++;
                    $image_id = get_post_thumbnail_id($post->ID, 'fullsize');
                    $image_url = wp_get_attachment_image_src($image_id, 'fullsize');
                    $image_url = $image_url[0];
                    $thumbnail_image_id = get_post_thumbnail_id($post->ID, 'gridblock-tiny');
                    $thumbnail_image_url = wp_get_attachment_image_src($thumbnail_image_id, 'gridblock-tiny');
                    $thumbnail_image_url = $thumbnail_image_url[0];
                    $imageTitle = get_the_title($post->ID);
                    $video = get_post_meta($post->ID, $vkey, true);
                    $hovericon = "imageicon";
                    $lightbox_url = $image_url;
                    if ($video != "") {
                        $hovericon = "videoicon";
                        $lightbox_url = $video;
                    }
                    if ($count == $columnbreak) {
                        $class_string = $hovericon;
                        $count = 0;
                    } else {
                        $class_string = "rightspace " . $hovericon;
                    }
                    ?>

						<li class="<?php 
                    echo $class_string;
                    ?>
">
						<?php 
                    if ($clickaction == "lightbox") {
                        ?>
							<a rel="prettyPhoto[<?php 
                        echo $args['widget_id'];
                        ?>
]" href="<?php 
                        echo $lightbox_url;
                        ?>
">
							<?php 
                    } else {
                        ?>
							<a href="<?php 
                        the_permalink();
                        ?>
">
							<?php 
                    }
                    ?>
								<?php 
                    echo mtheme_display_post_image($post->ID, $have_image_url = $thumbnail_image_url, $link = false, $type = "", $post->post_title, $class = "sidegalleryfade");
                    ?>
							</a>
						</li>
							<?php 
                }
                ?>
							
			
			<?php 
                wp_reset_query();
                break;
        }
        ?>
			</ul>
			<div class="clear"></div>
			</div>
		<?php 
        echo $after_widget;
    }
Esempio n. 3
0
     body {
         top:0;
         left:0;
         width:100%;
         height:100%;
         overflow:hidden;
     }
 </style>
 <div class="kenburns-preloader"></div>
 <div id="kenburns-container">
     <?php 
 // Loop through the images
 foreach ($filter_image_ids as $attachment_id) {
     $attachment = get_post($attachment_id);
     $imageURI = $attachment->guid;
     echo mtheme_display_post_image($post->ID, $have_image_url = $imageURI, $link = false, $type = "full", $post->post_title, $class = "kenburns-images");
 }
 ?>
 </div>
 <?php 
 // Static Titles and Description block
 $static_description = '';
 $static_title = '';
 $static_link_text = '';
 $slideshow_link = '';
 $slideshow_title = '';
 $slideshow_caption = '';
 $static_url = '';
 $custom = get_post_custom($featured_page);
 if (isset($custom[MTHEME . "_static_title"][0])) {
     $static_title = $custom[MTHEME . "_static_title"][0];
Esempio n. 4
0
function mRecentBlogListBox($atts, $content = null)
{
    extract(shortcode_atts(array("comments" => 'true', "date" => 'true', "columns" => '4', "limit" => '-1', "title" => 'true', "description" => 'true', "cat_slug" => '', "excerpt_length" => '15', "post_type" => '', "pagination" => 'false'), $atts));
    $column_type = "listbox";
    $portfolioImage_type = "gridblock-small";
    $portfolio_count = 0;
    $postformats = "";
    $terms = '';
    $terms = array();
    $count = 0;
    $flag_new_row = true;
    $portfoliogrid = '';
    $portfoliogrid .= '<div class="gridblock-listbox gridblock-columns-wrap clearfix">';
    $portfoliogrid .= '<ul class="gridblock-' . $column_type . ' clearfix">';
    if (get_query_var('paged')) {
        $paged = get_query_var('paged');
    } elseif (get_query_var('page')) {
        $paged = get_query_var('page');
    } else {
        $paged = 1;
    }
    if ($post_type != "") {
        $type_explode = explode(",", $post_type);
        foreach ($type_explode as $postformat) {
            $count++;
            $postformat_slug = "post-format-" . $postformat;
            $terms[] .= $postformat_slug;
        }
        query_posts(array('category_name' => $cat_slug, 'posts_per_page' => $limit, 'paged' => $paged, 'tax_query' => array(array('taxonomy' => 'post_format', 'field' => 'slug', 'terms' => $terms))));
    } else {
        query_posts(array('category_name' => $cat_slug, 'paged' => $paged, 'posts_per_page' => $limit));
    }
    if (have_posts()) {
        while (have_posts()) {
            the_post();
            //echo $type, $portfolio_type;
            $postformat = get_post_format();
            if ($postformat == "") {
                $postformat = "standard";
            }
            $portfolio_thumb_header = "Image";
            if ($portfolio_count == $columns) {
                $portfolio_count = 0;
            }
            $protected = "";
            $icon_class = "column-gridblock-icon";
            $portfolio_count++;
            $portfoliogrid .= '<li class="gridblock-listbox-row gridblock-col-' . $portfolio_count . ' clearfix">';
            $portfoliogrid .= '<div class="listbox-image">';
            $portfoliogrid .= '<span class="gridblock-link-hover">';
            $linkcenter = '';
            $linkcenter = "gridblock-link-center";
            switch ($postformat) {
                case 'video':
                    $postformat_icon = "icon-play";
                    break;
                case 'audio':
                    $postformat_icon = "icon-volume-up";
                    break;
                case 'gallery':
                    $postformat_icon = "icon-plus";
                    break;
                case 'quote':
                    $postformat_icon = "icon-quote-left";
                    break;
                case 'link':
                    $postformat_icon = "icon-link";
                    break;
                case 'aside':
                    $postformat_icon = "icon-pushpin";
                    break;
                case 'image':
                    $postformat_icon = "icon-picture";
                    break;
                default:
                    $postformat_icon = "icon-pencil";
                    break;
            }
            $portfoliogrid .= '<a href="' . get_permalink() . '"><span class="hover-icon-effect column-gridblock-link ' . $linkcenter . '"><i class="' . $postformat_icon . '"></i></span></a>';
            $portfoliogrid .= '</span>';
            //if Password Required
            if (post_password_required()) {
                $protected = " gridblock-protected";
                $iconclass = "";
                $portfoliogrid .= '<a class="grid-blank-element ' . $protected . ' gridblock-image-link gridblock-columns" title="' . get_the_title() . '" href="' . get_permalink() . '" >';
                $portfoliogrid .= '<span class="grid-blank-status"><i class="icon-lock icon-2x"></i></span>';
                $portfoliogrid .= '<div class="gridblock-protected"><img src="' . MTHEME_PATH . '/images/icons/blank-grid.png" /></div>';
            } else {
                if (!has_post_thumbnail()) {
                    $portfoliogrid .= '<a class="grid-blank-element ' . $protected . ' gridblock-image-link gridblock-columns" title="' . get_the_title() . '" href="' . get_permalink() . '" >';
                    $portfoliogrid .= '<span class="grid-blank-status"><i class="' . $postformat_icon . ' icon-2x"></i></span>';
                    $portfoliogrid .= '<div class="gridblock-protected"><img src="' . MTHEME_PATH . '/images/icons/blank-grid.png" /></div>';
                }
                if (has_post_thumbnail()) {
                    //Make sure it's not a slideshow
                    //Switch check for Linked Type
                    $portfoliogrid .= '<a class="gridblock-image-link gridblock-columns" href="' . get_permalink() . '" rel="bookmark" title="' . get_the_title() . '">';
                    // Display Hover icon trigger classes
                    // If it aint slideshow then display a background. Otherwise one is active in slideshow thumbnails.
                    $portfoliogrid .= '<span class="gridblock-background-hover"></span>';
                    // Custom Thumbnail
                    //Display Image
                    $portfoliogrid .= mtheme_display_post_image(get_the_ID(), $have_image_url = "", $link = false, $type = $portfolioImage_type, $imagetitle = '', $class = "preload-image displayed-image");
                } else {
                    $portfoliogrid .= '<a class="' . $protected . ' gridblock-image-link gridblock-columns" title="' . get_the_title() . '" href="' . get_permalink() . '" >';
                    $portfoliogrid .= '<div class="post-nothumbnail"></div>';
                }
            }
            $portfoliogrid .= '</a>';
            $portfoliogrid .= '<div class="listbox-content">';
            $portfoliogrid .= '<div class="summary-info">';
            $category = get_the_category();
            if ($comments == 'true') {
                $portfoliogrid .= '<div class="summary-comment">';
                $num_comments = get_comments_number(get_the_id());
                // get_comments_number returns only a numeric value
                if (comments_open()) {
                    if ($num_comments == 0) {
                        $comments_desc = __('0 <i class="icon-comment-alt"></i>');
                    } elseif ($num_comments > 1) {
                        $comments_desc = $num_comments . __(' <i class="icon-comment-alt"></i>');
                    } else {
                        $comments_desc = __('1 <i class="icon-comment-alt"></i>');
                    }
                    $portfoliogrid .= '<a href="' . get_comments_link(get_the_id()) . '">' . $comments_desc . '</a>';
                }
                $portfoliogrid .= '</div>';
            }
            if ($date == 'true') {
                $portfoliogrid .= '<div class="summary-date"><i class="icon-time"></i> ' . get_the_date('jS M y') . '</div>';
            }
            $portfoliogrid .= '</div>';
            $portfoliogrid .= '</div>';
            // If either of title and description needs to be displayed.
            if ($title == "true" || $description == "true") {
                $portfoliogrid .= '<div class="work-details">';
                $hreflink = get_permalink();
                if ($title == "true") {
                    $portfoliogrid .= '<h4><a href="' . $hreflink . '" rel="bookmark" title="' . get_the_title() . '">' . get_the_title() . '</a></h4>';
                }
                $summary_content = mtheme_excerpt_limit($excerpt_length);
                if ($postformat == 'quote') {
                    $summary_content = get_post_meta(get_the_id(), MTHEME . '_meta_quote', true);
                }
                if ($description == "true") {
                    $portfoliogrid .= '<p class="entry-content work-description">' . $summary_content . '</p>';
                }
                $portfoliogrid .= '</div>';
            }
            $portfoliogrid .= '</div>';
            $portfoliogrid .= '</li>';
        }
    }
    $portfoliogrid .= '</ul>';
    $portfoliogrid .= '</div>';
    if ($pagination == 'true') {
        $portfoliogrid .= mtheme_pagination();
    }
    wp_reset_query();
    return $portfoliogrid;
}
         echo '<div>';
     }
     switch ($portfolio_page_header) {
         case "Slideshow":
             $flexi_slideshow = do_shortcode('[flexislideshow slideshowtitle=true lightbox=true lboxtitle=true imagesize="gridblock-full"]');
             echo $flexi_slideshow;
             break;
         case "Vertical":
             $mtheme_thepostID = $post->ID;
             global $mtheme_thepostID;
             $vertical_images = do_shortcode('[vertical_images imagesize="gridblock-full"]');
             echo $vertical_images;
             break;
         case "Image":
             // Show Image
             echo mtheme_display_post_image($post->ID, $have_image_url = false, $link = false, $type = "fullwidth", $post->post_title, $class = "portfolio-single-image");
             break;
         case "Video":
             echo '<div class="fitVids">';
             echo $portfolio_videoembed;
             echo '</div>';
             break;
     }
 }
 ?>
         </div>
         <div class="portfolio-single-wrap clearfix" style="display: none">
             <?php 
 if (!isset($mtheme_pagestyle)) {
     $mtheme_pagestyle = "column";
 }
Esempio n. 6
0
/**
 * WooCommerce Featured Slideshow .
 *
 * @ [flexislideshow link=(lightbox,direct,none)]
 */
function mtheme_woocommerce_featured_Slideshow($atts, $content = null)
{
    extract(shortcode_atts(array("limit" => '-1', "cat_slug" => '', "transition" => 'fade', "limit" => ''), $atts));
    //echo $type, $portfolio_type;
    query_posts(array('post_type' => 'product', 'posts_per_page' => -1, 'meta_key' => '_featured', 'meta_value' => 'yes'));
    $flexID = "ID" . dechex(time()) . dechex(mt_rand(1, 65535));
    $uniqurePageID = get_the_id() . "-" . dechex(mt_rand(1, 65535));
    $portfolioImage_type = "blog-full";
    $output = '
	<div class="spaced-wrap woocommerce-slideshow clearfix">
		<div class="flexslider-container-page flexislider-container-' . $flexID . ' clearfix">
			<div id="flex' . $flexID . '" class="flexslider">
			<ul class="slides">';
    if (have_posts()) {
        while (have_posts()) {
            the_post();
            if (has_post_thumbnail()) {
                $output .= '<li class="slideshow-box-wrapper">';
                $output .= '<div class="slideshow-box-image">';
                $output .= mtheme_display_post_image(get_the_ID(), $have_image_url = "", $link = false, $theimage_type = $portfolioImage_type, $imagetitle = '', $class = "preload-image displayed-image");
                $output .= '</div>';
                $output .= '<div class="slideshow-box-content"><div class="slideshow-box-content-inner">';
                $output .= '<div class="slideshow-box-title"><a href="' . get_permalink() . '">' . get_the_title() . '</a></div>';
                $output .= '<div class="slideshow-box-info">';
                $output .= '<div class="slideshow-box-categories">';
                foreach (get_the_category() as $category) {
                    $output .= '<span>' . $category->cat_name . '</span>';
                }
                $output .= '</div>';
                $category = get_the_category();
                $output .= '<div class="slideshow-box-comment">';
                ob_start();
                woocommerce_get_template('loop/price.php');
                $price = ob_get_contents();
                ob_end_clean();
                $output .= '<div class="slideshow-box-date">' . $price . '</div>';
                $output .= '</div>';
                $output .= '</div></div>';
                $output .= '</li>';
            }
        }
    }
    $output .= '</ul></div></div><div class="clear"></div></div>';
    $output .= '
<script type="text/javascript">
	jQuery(window).load(function() {
		jQuery("#flex' . $flexID . '").flexslider({
			animation: "' . $transition . '",
			slideshow: true,
			pauseOnAction: true,
			pauseOnHover: true,
			smoothHeight: true,
			controlsContainer: "flexslider-container-' . $flexID . '",
			start: function(){
				jQuery(".flexslider-container-page,.gridblock-element .ajax-image-block").css("background","none");
			},
		});
	});
</script>
';
    wp_reset_query();
    return $output;
}
Esempio n. 7
0
    }
}
?>
<div id="ajax-gridblock-content" class="clearfix">
	<div class="ajax-gridblock-image-wrap">
	<div class="column32 column_space">
	<?php 
if (!post_password_required($mtheme_thepostID)) {
    switch ($portfolio_page_header) {
        case "Slideshow":
            global $mtheme_thepostID;
            $flexi_slideshow = do_shortcode('[ajaxflexislideshow]');
            echo $flexi_slideshow;
            break;
        case "Image":
            echo mtheme_display_post_image($mtheme_thepostID, $have_image_url = false, $link = false, $type = "gridblock-ajax", $post_title = get_the_title(), $class = "");
            break;
        case "Vertical":
            global $mtheme_thepostID;
            $vertical_images = do_shortcode('[vertical_images imagesize="gridblock-full"]');
            echo $vertical_images;
            break;
        case "Video":
            echo '<div class="ajax-video-wrapper">';
            echo '<div class="ajax-video-container">';
            echo $custom[MTHEME . '_video_embed'][0];
            echo '</div>';
            echo '</div>';
            break;
    }
}
    function widget($args, $instance)
    {
        extract($args);
        $title = apply_filters('widget_title', empty($instance['title']) ? __('Related Projects', 'mthemelocal') : $instance['title'], $instance, $this->id_base);
        $text = $instance['text'];
        echo $before_widget;
        ?>
		
<?php 
        //for in the loop, display all "content", regardless of post_type,
        //that have the same custom taxonomy (e.g. genre) terms as the current post
        global $mtheme_portfolio_current_post, $post;
        if (isset($mtheme_portfolio_current_post)) {
            $portfolio_post_ID = $mtheme_portfolio_current_post->ID;
            //$backup = $post;  // backup the current object
            $found_none = '<h2>No related posts found! ' . $portfolio_post_ID . '</h2>';
            $taxonomy = 'types';
            //  e.g. post_tag, category, custom taxonomy
            $param_type = 'types';
            //  e.g. tag__in, category__in, but genre__in will NOT work
            $post_types = get_post_types(array('public' => true), 'names');
            $tax_args = array('orderby' => 'none');
            $tags = wp_get_post_terms($mtheme_portfolio_current_post->ID, $taxonomy, $tax_args);
            ?>

<?php 
            if ($tags) {
                foreach ($tags as $tag) {
                    //echo $tag->slug;
                    $args = array("{$param_type}" => $tag->slug, 'post__not_in' => array($portfolio_post_ID), 'post_type' => $post_types, 'showposts' => -1, 'ignore_sticky_posts' => 1);
                    $my_query = null;
                    $my_query = new WP_Query($args);
                    if ($my_query->have_posts()) {
                        if ($title) {
                            echo $before_title . $title . $after_title;
                        }
                        if (!empty($text)) {
                            ?>
<p class="portfoliorelated_widget_about"><?php 
                            echo $text;
                            ?>
</p><?php 
                        }
                        ?>
		
		<div class="grid-list-portfolio-related clearfix">
			<ul>
		
		<?php 
                        while ($my_query->have_posts()) {
                            $my_query->the_post();
                            ?>
			
			<li>
			<?php 
                            if (post_password_required()) {
                                $have_image_url = get_template_directory_uri() . '/images/icons/post_locked.png';
                            } else {
                                $have_image_url = false;
                            }
                            echo mtheme_display_post_image($post->ID, $have_image_url, $link = true, $type = "gridblock-tiny", $post->post_title, $class = "portfolio-related-image");
                            ?>
			</li>
			<?php 
                            $found_none = '';
                        }
                    }
                    ?>
	</ul>
</div>
<?php 
                    break;
                }
            }
            if ($found_none) {
                //echo $found_none;
            }
            //$post = $backup;  // copy it back
            wp_reset_query();
            // to use the original query again
            ?>
		
		<?php 
            echo $after_widget;
        }
    }
Esempio n. 9
0
             // Count
             $count++;
             $slideshow_title = "";
             $slideshow_caption = "";
             //Find and replace all new lines to BR tags
             $find = array("\r\n", "\n", "\r");
             $replace = '<br />';
             $imageDesc = str_replace($find, $replace, $imageDesc);
             if ($imageTitle) {
                 $slideshow_title = '<div class="slideshow_title">' . esc_attr($imageTitle) . '</div>';
             }
             if ($imageDesc) {
                 $slideshow_caption = '<div class="slideshow_caption">' . $imageDesc . '</div>';
             }
             echo '<div class="photowall-item item">';
             echo mtheme_display_post_image($post->ID, $have_image_url = $imageURI, $link = false, $type = "portfolio-square", $post->post_title, $class = "photowall-image");
             if ($imageTitle) {
                 echo '<a class="photowall-lightbox" rel="prettyPhoto[photowall]" href="' . $imageURI . '">';
                 echo '</a>';
                 echo '<div class="photowall-box">';
                 echo '<div class="photowall-title">' . $imageTitle . '</div>';
                 echo '<div class="photowall-desc">' . $imageDesc . '</div>';
                 echo '</div>';
             }
             echo '<div class="photowall-content-wrap">';
             echo '</div>';
             echo '</div>';
         }
     }
     // If Ends here for the Featured Page
 }
Esempio n. 10
0
<?php

global $mtheme_pagelayout_type;
$width = MTHEME_MAX_CONTENT_WIDTH;
$single_height = '';
$posthead_size = "blog-full";
$blogpost_style = get_post_meta($post->ID, MTHEME . '_pagestyle', true);
if ($blogpost_style == "nosidebar") {
    $posthead_size = "fullpage";
}
if ($mtheme_pagelayout_type == "fullwidth") {
    $posthead_size = "fullwidth";
}
if ($mtheme_pagelayout_type == "two-column") {
    $posthead_size = "blog-full";
}
echo '<a class="postsummaryimage" href="' . get_permalink() . '">';
// Show Image
echo mtheme_display_post_image($post->ID, $have_image_url = false, $link = false, $type = $posthead_size, $post->post_title, $class = "");
echo '</a>';