" class="bcarousellink">
				<header>
			        <h5 class="entry-title" itemprop="name headline"><?php 
        the_title();
        ?>
</h5>
			        <div class="subhead" itemprop="datePublished">
			        <span class="postday"><?php 
        echo get_the_date(get_option('date_format'));
        ?>
</span>
			        </div>
				</header>
		       	<div class="entry-content" itemprop="articleBody">
		        <p><?php 
        echo virtue_excerpt(16);
        ?>
</p>
		        </div>
				 </a>
                </div>
			</div>
		<?php 
    }
} else {
    ?>
			<div class="error-not-found"><?php 
    _e('Sorry, no blog entries found.', 'virtue');
    ?>
</div>	
				<?php 
function kad_portfolio_shortcode_function($atts, $content)
{
    extract(shortcode_atts(array('orderby' => 'menu_order', 'cat' => '', 'order' => '', 'offset' => null, 'id' => rand(10, 100), 'columns' => '4', 'lightbox' => '', 'height' => '', 'filter' => false, 'excerpt' => false, 'showtypes' => '', 'items' => '4'), $atts));
    if (!empty($order)) {
        $order = $order;
    } else {
        if ($orderby == 'menu_order') {
            $order = 'ASC';
        } else {
            $order = 'DESC';
        }
    }
    if (empty($cat)) {
        $cat = '';
        $portfolio_cat_ID = '';
    } else {
        $portfolio_cat = get_term_by('slug', $cat, 'portfolio-type');
        $portfolio_cat_ID = $portfolio_cat->term_id;
    }
    if ($columns == '2') {
        $itemsize = 'tcol-md-6 tcol-sm-6 tcol-xs-12 tcol-ss-12';
        $slidewidth = 560;
        $slideheight = 560;
    } else {
        if ($columns == '1') {
            $itemsize = 'tcol-md-12 tcol-sm-12 tcol-xs-12 tcol-ss-12';
            $slidewidth = 560;
            $slideheight = 560;
        } else {
            if ($columns == '3') {
                $itemsize = 'tcol-md-4 tcol-sm-4 tcol-xs-6 tcol-ss-12';
                $slidewidth = 366;
                $slideheight = 366;
            } else {
                if ($columns == '6') {
                    $itemsize = 'tcol-md-2 tcol-sm-3 tcol-xs-4 tcol-ss-6';
                    $slidewidth = 240;
                    $slideheight = 240;
                } else {
                    if ($columns == '5') {
                        $itemsize = 'tcol-md-25 tcol-sm-3 tcol-xs-4 tcol-ss-6';
                        $slidewidth = 240;
                        $slideheight = 240;
                    } else {
                        $itemsize = 'tcol-md-3 tcol-sm-4 tcol-xs-6 tcol-ss-12';
                        $slidewidth = 270;
                        $slideheight = 270;
                    }
                }
            }
        }
    }
    if (!empty($height) && $height == 'none') {
        $slideheight = null;
    } else {
        if (!empty($height)) {
            $slideheight = $height;
        }
    }
    global $virtue_premium;
    if (isset($virtue_premium['virtue_animate_in']) && $virtue_premium['virtue_animate_in'] == 1) {
        $animate = 1;
    } else {
        $animate = 0;
    }
    ob_start();
    ?>
	<?php 
    if ($filter) {
        ?>
      	<section id="options" class="clearfix">
			<?php 
        global $virtue_premium;
        if (!empty($virtue_premium['filter_all_text'])) {
            $alltext = $virtue_premium['filter_all_text'];
        } else {
            $alltext = __('All', 'virtue');
        }
        if (!empty($virtue_premium['portfolio_filter_text'])) {
            $portfoliofiltertext = $virtue_premium['portfolio_filter_text'];
        } else {
            $portfoliofiltertext = __('Filter Projects', 'virtue');
        }
        $termtypes = array('child_of' => $portfolio_cat_ID);
        $categories = get_terms('portfolio-type', $termtypes);
        $count = count($categories);
        echo '<a class="filter-trigger headerfont" data-toggle="collapse" data-target=".filter-collapse"><i class="icon-tags"></i> ' . $portfoliofiltertext . '</a>';
        echo '<ul id="filters" class="clearfix option-set filter-collapse">';
        echo '<li class="postclass"><a href="#" data-filter="*" title="All" class="selected"><h5>' . $alltext . '</h5><div class="arrow-up"></div></a></li>';
        if ($count > 0) {
            foreach ($categories as $category) {
                $termname = strtolower($category->slug);
                $termname = preg_replace("/[^a-zA-Z 0-9]+/", " ", $termname);
                $termname = str_replace(' ', '-', $termname);
                echo '<li class="postclass"><a href="#" data-filter=".' . esc_attr($termname) . '" title="" rel="' . esc_attr($termname) . '"><h5>' . $category->name . '</h5><div class="arrow-up"></div></a></li>';
            }
        }
        echo "</ul>";
        ?>
			</section>
            <?php 
    }
    ?>
				<div class="home-portfolio">
						<div id="portfoliowrapper-<?php 
    echo $id;
    ?>
" class="rowtight init-isotope" data-fade-in="<?php 
    echo esc_attr($animate);
    ?>
" data-iso-selector=".p-item" data-iso-style="masonry" data-iso-filter="true"> 
            <?php 
    $wp_query = null;
    $wp_query = new WP_Query();
    $wp_query->query(array('orderby' => $orderby, 'order' => $order, 'offset' => $offset, 'post_type' => 'portfolio', 'portfolio-type' => $cat, 'posts_per_page' => $items));
    if ($wp_query) {
        while ($wp_query->have_posts()) {
            $wp_query->the_post();
            ?>

				<?php 
            global $post;
            $terms = get_the_terms($post->ID, 'portfolio-type');
            if ($terms && !is_wp_error($terms)) {
                $links = array();
                foreach ($terms as $term) {
                    $links[] = $term->slug;
                }
                $links = preg_replace("/[^a-zA-Z 0-9]+/", " ", $links);
                $links = str_replace(' ', '-', $links);
                $tax = join(" ", $links);
            } else {
                $tax = '';
            }
            ?>
				
				<div class="<?php 
            echo esc_attr($itemsize);
            ?>
 <?php 
            echo strtolower($tax);
            ?>
 all p-item">
                	<div class="grid_item portfolio_item kad_portfolio_fade_in kt_item_fade_in kad-light-gallery postclass">
					<?php 
            global $post;
            $postsummery = get_post_meta($post->ID, '_kad_post_summery', true);
            if ($postsummery == 'slider') {
                ?>
                           	<div class="flexslider kt-flexslider loading imghoverclass clearfix" data-flex-speed="7000" data-flex-initdelay="<?php 
                echo rand(10, 2000);
                ?>
" data-flex-anim-speed="400" data-flex-animation="fade" data-flex-auto="true">
                       			<ul class="slides">
                       		<?php 
                $image_gallery = get_post_meta($post->ID, '_kad_image_gallery', true);
                if (!empty($image_gallery)) {
                    $attachments = array_filter(explode(',', $image_gallery));
                    if ($attachments) {
                        foreach ($attachments as $attachment) {
                            $attachment_url = wp_get_attachment_url($attachment, 'full');
                            $image = aq_resize($attachment_url, $slidewidth, $slideheight, true);
                            if (empty($image)) {
                                $image = $attachment_url;
                            }
                            ?>
												<li>
													<a href="<?php 
                            the_permalink();
                            ?>
" alt="<?php 
                            the_title();
                            ?>
">
														<img src="<?php 
                            echo esc_url($image);
                            ?>
"/>
													</a>
													<?php 
                            if ($lightbox) {
                                ?>
														<a href="<?php 
                                echo esc_url($attachment_url);
                                ?>
" class="kad_portfolio_lightbox_link" title="<?php 
                                the_title();
                                ?>
" data-rel="lightbox">
															<i class="icon-search"></i>
														</a>
													<?php 
                            }
                            ?>
												</li>
												<?php 
                        }
                    }
                } else {
                    $attach_args = array('order' => 'ASC', 'post_type' => 'attachment', 'post_parent' => $post->ID, 'post_mime_type' => 'image', 'post_status' => null, 'orderby' => 'menu_order', 'numberposts' => -1);
                    $attachments = get_posts($attach_args);
                    if ($attachments) {
                        foreach ($attachments as $attachment) {
                            $attachment_url = wp_get_attachment_url($attachment->ID, 'full');
                            $image = aq_resize($attachment_url, $slidewidth, $slideheight, true);
                            if (empty($image)) {
                                $image = $attachment_url;
                            }
                            ?>
												<li>
													<a href="<?php 
                            the_permalink();
                            ?>
" alt="<?php 
                            the_title();
                            ?>
">
														<img src="<?php 
                            echo esc_url($image);
                            ?>
"/>
													</a>
													<?php 
                            if ($lightbox) {
                                ?>
														<a href="<?php 
                                echo esc_url($attachment_url);
                                ?>
" class="kad_portfolio_lightbox_link" title="<?php 
                                the_title();
                                ?>
" data-rel="lightbox">
															<i class="icon-search"></i>
														</a>
													<?php 
                            }
                            ?>
												</li>
												<?php 
                        }
                    }
                }
                ?>
  
								</ul>
              				</div> <!--Flex Slides-->
              <?php 
            } else {
                if (has_post_thumbnail($post->ID)) {
                    $image_url = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full');
                    $thumbnailURL = $image_url[0];
                    $image = aq_resize($thumbnailURL, $slidewidth, $slideheight, true);
                    if (empty($image)) {
                        $image = $thumbnailURL;
                    }
                    ?>
								<div class="imghoverclass">
	                                <a href="<?php 
                    the_permalink();
                    ?>
" title="<?php 
                    the_title();
                    ?>
">
	                                    <img src="<?php 
                    echo esc_url($image);
                    ?>
" alt="<?php 
                    the_title();
                    ?>
" class="lightboxhover" style="display: block;">
	                                </a> 
	                           	</div>
	                            <?php 
                    if (!empty($lightbox)) {
                        ?>
	                            	<a href="<?php 
                        echo esc_url($thumbnailURL);
                        ?>
" class="kad_portfolio_lightbox_link" title="<?php 
                        the_title();
                        ?>
" data-rel="lightbox">
	                            		<i class="icon-search"></i>
	                            	</a>
	                            <?php 
                    }
                    $image = null;
                    $thumbnailURL = null;
                    ?>
                           <?php 
                }
            }
            ?>
			              	<a href="<?php 
            the_permalink();
            ?>
" class="portfoliolink">
			              		<div class="piteminfo">   
			                          <h5><?php 
            the_title();
            ?>
</h5>
			                           <?php 
            if (empty($showtypes)) {
                $terms = get_the_terms($post->ID, 'portfolio-type');
                if ($terms) {
                    ?>
 
				                           		<p class="cportfoliotag"><?php 
                    $output = array();
                    foreach ($terms as $term) {
                        $output[] = $term->name;
                    }
                    echo implode(', ', $output);
                    ?>
</p>
				                           	<?php 
                }
            }
            ?>
				                           <?php 
            if ($excerpt == true) {
                ?>
				                           		<p><?php 
                echo virtue_excerpt(16);
                ?>
</p> 
				                           <?php 
            }
            ?>
			                    </div>
			                </a>
                </div>
            </div>
			<?php 
        }
    } else {
        ?>
				<li class="error-not-found"><?php 
        _e('Sorry, no portfolio entries found.', 'virtue');
        ?>
</li>
			<?php 
    }
    ?>
          	</div> <!-- portfoliowrapper -->
            <?php 
    $wp_query = null;
    wp_reset_query();
    ?>
		</div><!-- /.home-portfolio -->

	<?php 
    $output = ob_get_contents();
    ob_end_clean();
    return $output;
}
" class="bcarousellink">
							        <header>
						               	<h5 class="entry-title" itemprop="name headline"><?php 
        the_title();
        ?>
</h5>
						                <div class="subhead" itemprop="datePublished">
						                	<span class="postday"><?php 
        echo get_the_date(get_option('date_format'));
        ?>
</span>
						                </div>
						            </header>
		                    		<div class="entry-content" itemprop="articleBody">
		                        		<p><?php 
        echo strip_tags(virtue_excerpt(16));
        ?>
</p>
		                    		</div>
                           		</a>
	                 	</div>
	            	</div>
            		<?php 
    }
} else {
    ?>
					<div class="error-not-found"><?php 
    _e('Sorry, no blog entries found.', 'virtue');
    ?>
</div>	
					<?php 
function kad_carousel_shortcode_function($atts, $content)
{
    extract(shortcode_atts(array('type' => '', 'id' => rand(10, 100), 'columns' => '4', 'orderby' => '', 'order' => '', 'offset' => null, 'speed' => '9000', 'scroll' => '', 'portfolio_show_excerpt' => false, 'portfolio_show_types' => false, 'cat' => '', 'readmore' => false, 'items' => '8'), $atts));
    if (empty($type)) {
        $type = 'post';
    }
    if (empty($orderby)) {
        $orderby = 'menu_order';
    }
    if (!empty($order)) {
        $order = $order;
    } else {
        if ($orderby == 'menu_order') {
            $order = 'ASC';
        } else {
            $order = 'DESC';
        }
    }
    if (!empty($cat)) {
        $carousel_category = $cat;
    } else {
        $carousel_category = '';
    }
    if (empty($scroll) || $scroll == 1) {
        $scroll = '1';
    } else {
        $scroll = null;
    }
    if ($columns == '2') {
        $itemsize = 'tcol-lg-6 tcol-md-6 tcol-sm-6 tcol-xs-12 tcol-ss-12';
        $slidewidth = 560;
        $slideheight = 560;
        $md = 2;
        $sm = 2;
        $xs = 1;
        $ss = 1;
    } else {
        if ($columns == '1') {
            $itemsize = 'tcol-lg-12 tcol-md-12 tcol-sm-12 tcol-xs-12 tcol-ss-12';
            $slidewidth = 560;
            $slideheight = 560;
            $md = 1;
            $sm = 1;
            $xs = 1;
            $ss = 1;
        } else {
            if ($columns == '3') {
                $itemsize = 'tcol-lg-4 tcol-md-4 tcol-sm-4 tcol-xs-6 tcol-ss-12';
                $slidewidth = 400;
                $slideheight = 400;
                $md = 3;
                $sm = 3;
                $xs = 2;
                $ss = 1;
            } else {
                if ($columns == '8') {
                    $itemsize = 'tcol-lg-2 tcol-md-2 tcol-sm-3 tcol-xs-4 tcol-ss-6';
                    $slidewidth = 200;
                    $slideheight = 200;
                    $md = 8;
                    $sm = 6;
                    $xs = 4;
                    $ss = 2;
                } else {
                    if ($columns == '6') {
                        $itemsize = 'tcol-lg-2 tcol-md-2 tcol-sm-3 tcol-xs-4 tcol-ss-6';
                        $slidewidth = 240;
                        $slideheight = 240;
                        $md = 6;
                        $sm = 4;
                        $xs = 3;
                        $ss = 2;
                    } else {
                        if ($columns == '5') {
                            $itemsize = 'tcol-lg-25 tcol-md-25 tcol-sm-3 tcol-xs-4 tcol-ss-6';
                            $slidewidth = 240;
                            $slideheight = 240;
                            $md = 5;
                            $sm = 4;
                            $xs = 3;
                            $ss = 2;
                        } else {
                            $itemsize = 'tcol-lg-3 tcol-md-3 tcol-sm-4 tcol-xs-6 tcol-ss-12';
                            $slidewidth = 300;
                            $slideheight = 300;
                            $md = 4;
                            $sm = 3;
                            $xs = 2;
                            $ss = 1;
                        }
                    }
                }
            }
        }
    }
    ob_start();
    ?>
	<div class="carousel_outerrim kad-animation" data-animation="fade-in" data-delay="0">
		<div class="home-margin carousel_outerrim_load fredcarousel">
			<div id="carouselcontainer-<?php 
    echo esc_attr($id);
    ?>
" class="rowtight fadein-carousel">
				<div id="carousel-<?php 
    echo esc_attr($id);
    ?>
" class="clearfix caroufedselclass products initcaroufedsel" data-carousel-container="#carouselcontainer-<?php 
    echo esc_attr($id);
    ?>
" data-carousel-transition="300" data-carousel-scroll="<?php 
    echo esc_attr($scroll);
    ?>
" data-carousel-auto="true" data-carousel-speed="<?php 
    echo esc_attr($speed);
    ?>
" data-carousel-id="<?php 
    echo esc_attr($id);
    ?>
" data-carousel-md="<?php 
    echo esc_attr($md);
    ?>
" data-carousel-sm="<?php 
    echo esc_attr($sm);
    ?>
" data-carousel-xs="<?php 
    echo esc_attr($xs);
    ?>
" data-carousel-ss="<?php 
    echo esc_attr($ss);
    ?>
">
				
				<?php 
    if ($type == "portfolio") {
        $wp_query = null;
        $wp_query = new WP_Query();
        $wp_query->query(array('orderby' => $orderby, 'order' => $order, 'offset' => $offset, 'post_type' => 'portfolio', 'portfolio-type' => $carousel_category, 'posts_per_page' => $items));
        if ($wp_query) {
            while ($wp_query->have_posts()) {
                $wp_query->the_post();
                ?>
							<div class="<?php 
                echo esc_attr($itemsize);
                ?>
 kad_product">
								<div class="grid_item portfolio_item postclass">
	                        	<?php 
                global $post;
                $postsummery = get_post_meta($post->ID, '_kad_post_summery', true);
                if ($postsummery == 'slider') {
                    ?>
	                           			<div class="flexslider kt-flexslider imghoverclass clearfix"  data-flex-speed="7000" data-flex-initdelay="0" data-flex-anim-speed="400" data-flex-animation="fade" data-flex-auto="true">
		                       				<ul class="slides">
		                       				<?php 
                    $image_gallery = get_post_meta($post->ID, '_kad_image_gallery', true);
                    $attachments = array_filter(explode(',', $image_gallery));
                    if ($attachments) {
                        foreach ($attachments as $attachment) {
                            $attachment_url = wp_get_attachment_url($attachment, 'full');
                            $image = aq_resize($attachment_url, $slidewidth, $slideheight, true);
                            if (empty($image)) {
                                $image = $attachment_url;
                            }
                            echo '<li><img src="' . esc_url($image) . '" width="' . esc_attr($slidewidth) . '" height="' . esc_attr($slideheight) . '"/></li>';
                        }
                    }
                    ?>
  
											</ul>
	              						</div> <!--Flex Slides-->
	    							<?php 
                } else {
                    if (has_post_thumbnail($post->ID)) {
                        $image_url = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full');
                        $thumbnailURL = $image_url[0];
                        $image = aq_resize($thumbnailURL, $slidewidth, $slideheight, true);
                        if (empty($image)) {
                            $image = $thumbnailURL;
                        }
                        ?>
												<div class="imghoverclass">
													<a href="<?php 
                        the_permalink();
                        ?>
" title="<?php 
                        the_title();
                        ?>
">
														<img src="<?php 
                        echo esc_url($image);
                        ?>
" alt="<?php 
                        the_title();
                        ?>
" width="<?php 
                        echo esc_attr($slidewidth);
                        ?>
" height="<?php 
                        echo esc_attr($slideheight);
                        ?>
" class="lightboxhover" style="display: block;">
													</a>
												</div>
	                           				<?php 
                        $image = null;
                        $thumbnailURL = null;
                    }
                }
                ?>
				              		<a href="<?php 
                the_permalink();
                ?>
" class="portfoliolink">
				              			<div class="piteminfo">
				              				<h5><?php 
                the_title();
                ?>
</h5>
				              				<?php 
                if ($portfolio_show_types == true) {
                    $terms = get_the_terms($post->ID, 'portfolio-type');
                    if ($terms) {
                        ?>
 <p class="cportfoliotag"><?php 
                        $output = array();
                        foreach ($terms as $term) {
                            $output[] = $term->name;
                        }
                        echo implode(', ', $output);
                        ?>
</p> <?php 
                    }
                }
                ?>
				              				<?php 
                if ($portfolio_show_excerpt == true) {
                    ?>
 <p><?php 
                    echo virtue_excerpt(16);
                    ?>
</p> <?php 
                }
                ?>
				              			</div>
				              		</a>
				                </div>
				            </div>
						<?php 
            }
        } else {
            ?>
							<li class="error-not-found"><?php 
            _e('Sorry, no portfolio entries found.', 'virtue');
            ?>
</li>
						<?php 
        }
        $wp_query = null;
        wp_reset_query();
        ?>

            	<?php 
    } else {
        if ($type == "post") {
            $wp_query = null;
            $wp_query = new WP_Query();
            $wp_query->query(array('orderby' => $orderby, 'order' => $order, 'offset' => $offset, 'post_type' => 'post', 'category_name' => $carousel_category, 'posts_per_page' => $items));
            if ($wp_query) {
                while ($wp_query->have_posts()) {
                    $wp_query->the_post();
                    ?>
						<div class="<?php 
                    echo esc_attr($itemsize);
                    ?>
 kad_product">
                			<div <?php 
                    global $post;
                    post_class('blog_item grid_item');
                    ?>
>
	                    		<?php 
                    if (has_post_thumbnail($post->ID)) {
                        $image_url = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full');
                        $thumbnailURL = $image_url[0];
                        $image = aq_resize($thumbnailURL, $slidewidth, $slideheight, true);
                        if (empty($image)) {
                            $image = $thumbnailURL;
                        }
                    } else {
                        $thumbnailURL = virtue_post_default_placeholder();
                        $image = aq_resize($thumbnailURL, $slidewidth, $slideheight, true);
                        if (empty($image)) {
                            $image = $thumbnailURL;
                        }
                    }
                    ?>
									<div class="imghoverclass">
		                           		<a href="<?php 
                    the_permalink();
                    ?>
" title="<?php 
                    the_title();
                    ?>
">
		                           			<img src="<?php 
                    echo esc_url($image);
                    ?>
" alt="<?php 
                    the_title();
                    ?>
" class="iconhover" style="display:block;">
		                           		</a> 
		                         	</div>
                           			<?php 
                    $image = null;
                    $thumbnailURL = null;
                    ?>
              						<a href="<?php 
                    the_permalink();
                    ?>
" class="bcarousellink">
				                    	<header>
			                          		<h5 class="entry-title"><?php 
                    the_title();
                    ?>
</h5>
			                          		<div class="subhead">
			                          			<span class="postday kad-hidedate"><?php 
                    echo get_the_date('j M Y');
                    ?>
</span>
			                        		</div>	
			                        	</header>
		                        		<div class="entry-content color_body">
		                          			<p>
		                          				<?php 
                    echo strip_tags(virtue_excerpt(16));
                    if ($readmore) {
                        global $virtue_premium;
                        if (!empty($virtue_premium['post_readmore_text'])) {
                            $readmoret = $virtue_premium['post_readmore_text'];
                        } else {
                            $readmoret = __('Read More', 'virtue');
                        }
                        echo $readmoret;
                    }
                    ?>
		                          			</p>
		                        		</div>
                           			</a>
               		 		</div>
						</div>
					<?php 
                }
            } else {
                ?>
						<div class="error-not-found"><?php 
                _e('Sorry, no post entries found.', 'virtue');
                ?>
</div>
					<?php 
            }
            $wp_query = null;
            wp_reset_query();
            ?>
								

            <?php 
        } else {
            if ($type == "featured-products") {
                global $woocommerce_loop;
                if ($columns == 1) {
                    $woocommerce_loop['columns'] = 3;
                } else {
                    $woocommerce_loop['columns'] = $columns;
                }
                $wp_query = null;
                $wp_query = new WP_Query();
                $wp_query->query(array('post_type' => 'product', 'meta_key' => '_featured', 'meta_value' => 'yes', 'post_status' => 'publish', 'offset' => $offset, 'orderby' => 'menu_order', 'posts_per_page' => $items));
                if ($wp_query) {
                    while ($wp_query->have_posts()) {
                        $wp_query->the_post();
                        woocommerce_get_template_part('content', 'product');
                    }
                }
                $wp_query = null;
                wp_reset_query();
            } else {
                if ($type == "sale-products") {
                    if (class_exists('woocommerce')) {
                        global $woocommerce, $woocommerce_loop;
                        $product_ids_on_sale = woocommerce_get_product_ids_on_sale();
                        $product_ids_on_sale[] = 0;
                        $meta_query = array();
                        $meta_query[] = $woocommerce->query->visibility_meta_query();
                        $meta_query[] = $woocommerce->query->stock_status_meta_query();
                    }
                    if ($columns == 1) {
                        $woocommerce_loop['columns'] = 3;
                    } else {
                        $woocommerce_loop['columns'] = $columns;
                    }
                    $wp_query = null;
                    $wp_query = new WP_Query();
                    $wp_query->query(array('post_type' => 'product', 'meta_query' => $meta_query, 'post__in' => $product_ids_on_sale, 'post_status' => 'publish', 'offset' => $offset, 'product_cat' => $carousel_category, 'orderby' => 'menu_order', 'posts_per_page' => $items));
                    if ($wp_query) {
                        while ($wp_query->have_posts()) {
                            $wp_query->the_post();
                            woocommerce_get_template_part('content', 'product');
                        }
                    }
                    $wp_query = null;
                    wp_reset_query();
                } else {
                    if ($type == "best-products") {
                        global $woocommerce_loop;
                        if ($columns == 1) {
                            $woocommerce_loop['columns'] = 3;
                        } else {
                            $woocommerce_loop['columns'] = $columns;
                        }
                        $wp_query = null;
                        $wp_query = new WP_Query();
                        $wp_query->query(array('post_type' => 'product', 'meta_key' => 'total_sales', 'orderby' => 'meta_value_num', 'post_status' => 'publish', 'offset' => $offset, 'posts_per_page' => $items));
                        if ($wp_query) {
                            while ($wp_query->have_posts()) {
                                $wp_query->the_post();
                                woocommerce_get_template_part('content', 'product');
                            }
                        }
                        $wp_query = null;
                        wp_reset_query();
                    } else {
                        if ($type == "cat-products") {
                            global $woocommerce_loop;
                            if ($columns == 1) {
                                $woocommerce_loop['columns'] = 3;
                            } else {
                                $woocommerce_loop['columns'] = $columns;
                            }
                            $wp_query = null;
                            $wp_query = new WP_Query();
                            $wp_query->query(array('post_type' => 'product', 'orderby' => $orderby, 'order' => $order, 'offset' => $offset, 'product_cat' => $carousel_category, 'post_status' => 'publish', 'posts_per_page' => $items));
                            if ($wp_query) {
                                while ($wp_query->have_posts()) {
                                    $wp_query->the_post();
                                    woocommerce_get_template_part('content', 'product');
                                }
                            }
                            $wp_query = null;
                            wp_reset_query();
                        }
                    }
                }
            }
        }
    }
    ?>
           		</div>
			</div>
			<div class="clearfix"></div>
            <a id="prevport-<?php 
    echo esc_attr($id);
    ?>
" class="prev_carousel icon-arrow-left" href="#"></a>
			<a id="nextport-<?php 
    echo esc_attr($id);
    ?>
" class="next_carousel icon-arrow-right" href="#"></a>
		</div>
	</div>			

	<?php 
    $output = ob_get_contents();
    ob_end_clean();
    return $output;
}
Example #5
0
			                          	<span class="kad-hidepostedin">|</span>
			                        	<span class="postcommentscount" rel="tooltip" data-placement="top" data-original-title="<?php 
            $num_comments = get_comments_number();
            echo esc_attr($num_comments);
            ?>
">
			                        		<i class="icon-bubbles"></i>
			                        	</span>
			                        	<?php 
        }
        ?>
			                        </div>
			                        </header>
		                        	<div class="entry-content" itemprop="articleBody">
		                          		<p><?php 
        echo virtue_excerpt($blogwordcount);
        ?>
 <a href="<?php 
        the_permalink();
        ?>
">
		                          			<?php 
        global $virtue_premium;
        if (!empty($virtue_premium['post_readmore_text'])) {
            $readmore = $virtue_premium['post_readmore_text'];
        } else {
            $readmore = __('Read More', 'virtue');
        }
        echo $readmore;
        ?>
</a></p>
Example #6
0
function kad_carousel_shortcode_function($atts, $content)
{
    extract(shortcode_atts(array('type' => '', 'columns' => '4', 'orderby' => '', 'speed' => '9000', 'scroll' => '', 'cat' => '', 'readmore' => false, 'items' => '8'), $atts));
    $carousel_rn = rand(10, 100);
    if (empty($type)) {
        $type = 'post';
    }
    if (empty($orderby)) {
        $orderby = 'menu_order';
    }
    if ($orderby == 'menu_order') {
        $order = 'ASC';
    } else {
        $order = 'DESC';
    }
    if (empty($cat)) {
        $cat = '';
    }
    if (empty($scroll) || $scroll == 1) {
        $scroll = 'items:1,';
    } else {
        $scroll = '';
    }
    ob_start();
    ?>
				<div class="carousel_outerrim kad-animation" data-animation="fade-in" data-delay="0">
				<div class="home-margin fredcarousel">
				<div id="carouselcontainer-<?php 
    echo $carousel_rn;
    ?>
" class="rowtight fadein-carousel">
				<div id="carousel-<?php 
    echo $carousel_rn;
    ?>
" class="clearfix caroufedselclass products">
	<?php 
    if ($type == "portfolio") {
        if ($columns == '2') {
            $itemsize = 'tcol-lg-6 tcol-md-6 tcol-sm-6 tcol-xs-12 tcol-ss-12';
            $slidewidth = 560;
            $slideheight = 560;
            $md = 2;
            $sm = 2;
            $xs = 1;
            $ss = 1;
        } else {
            if ($columns == '1') {
                $itemsize = 'tcol-lg-12 tcol-md-12 tcol-sm-12 tcol-xs-12 tcol-ss-12';
                $slidewidth = 560;
                $slideheight = 560;
                $md = 1;
                $sm = 1;
                $xs = 1;
                $ss = 1;
            } else {
                if ($columns == '3') {
                    $itemsize = 'tcol-lg-4 tcol-md-4 tcol-sm-4 tcol-xs-6 tcol-ss-12';
                    $slidewidth = 400;
                    $slideheight = 400;
                    $md = 3;
                    $sm = 3;
                    $xs = 2;
                    $ss = 1;
                } else {
                    if ($columns == '6') {
                        $itemsize = 'tcol-lg-2 tcol-md-2 tcol-sm-3 tcol-xs-4 tcol-ss-6';
                        $slidewidth = 240;
                        $slideheight = 240;
                        $md = 6;
                        $sm = 4;
                        $xs = 3;
                        $ss = 2;
                    } else {
                        if ($columns == '5') {
                            $itemsize = 'tcol-lg-25 tcol-md-25 tcol-sm-3 tcol-xs-4 tcol-ss-6';
                            $slidewidth = 240;
                            $slideheight = 240;
                            $md = 5;
                            $sm = 4;
                            $xs = 3;
                            $ss = 2;
                        } else {
                            $itemsize = 'tcol-lg-3 tcol-md-3 tcol-sm-4 tcol-xs-6 tcol-ss-12';
                            $slidewidth = 300;
                            $slideheight = 300;
                            $md = 4;
                            $sm = 3;
                            $xs = 2;
                            $ss = 1;
                        }
                    }
                }
            }
        }
        if (!empty($cat)) {
            $portfolio_category = $cat;
        } else {
            $portfolio_category = '';
        }
        $wp_query = null;
        $wp_query = new WP_Query();
        $wp_query->query(array('orderby' => $orderby, 'order' => $order, 'post_type' => 'portfolio', 'portfolio-type' => $portfolio_category, 'posts_per_page' => $items));
        if ($wp_query) {
            while ($wp_query->have_posts()) {
                $wp_query->the_post();
                ?>
							<div class="<?php 
                echo $itemsize;
                ?>
 kad_product">
							<div class="grid_item portfolio_item postclass">
                        	<?php 
                global $post;
                $postsummery = get_post_meta($post->ID, '_kad_post_summery', true);
                if ($postsummery == 'slider') {
                    ?>
                           		<div class="flexslider imghoverclass clearfix">
                       			<ul class="slides">
                       			<?php 
                    $image_gallery = get_post_meta($post->ID, '_kad_image_gallery', true);
                    $attachments = array_filter(explode(',', $image_gallery));
                    if ($attachments) {
                        foreach ($attachments as $attachment) {
                            $attachment_url = wp_get_attachment_url($attachment, 'full');
                            $image = aq_resize($attachment_url, $slidewidth, $slideheight, true);
                            if (empty($image)) {
                                $image = $attachment_url;
                            }
                            echo '<li><img src="' . $image . '" width="' . $slidewidth . '" height="' . $slideheight . '"/></li>';
                        }
                    }
                    ?>
  
								</ul>
              					</div> <!--Flex Slides-->
              			<script type="text/javascript">jQuery(window).load(function () {jQuery('.flexslider').flexslider({animation: "fade",animationSpeed: 400,slideshow: true,slideshowSpeed: 7000, before: function(slider) {slider.removeClass('loading');}  }); });</script>
              <?php 
                } else {
                    if (has_post_thumbnail($post->ID)) {
                        $image_url = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full');
                        $thumbnailURL = $image_url[0];
                        $image = aq_resize($thumbnailURL, $slidewidth, $slideheight, true);
                        if (empty($image)) {
                            $image = $thumbnailURL;
                        }
                        ?>
									<div class="imghoverclass"><a href="<?php 
                        the_permalink();
                        ?>
" title="<?php 
                        the_title();
                        ?>
"><img src="<?php 
                        echo $image;
                        ?>
" alt="<?php 
                        the_title();
                        ?>
" width="<?php 
                        echo $slidewidth;
                        ?>
" height="<?php 
                        echo $slideheight;
                        ?>
" class="lightboxhover" style="display: block;"></a> </div>
                           			<?php 
                        $image = null;
                        $thumbnailURL = null;
                        ?>
                        <?php 
                    }
                }
                ?>
              		<a href="<?php 
                the_permalink();
                ?>
" class="portfoliolink"><div class="piteminfo"><h5><?php 
                the_title();
                ?>
</h5></div></a>
                	</div></div>
					<?php 
            }
        } else {
            ?>
					<li class="error-not-found"><?php 
            _e('Sorry, no portfolio entries found.', 'virtue');
            ?>
</li>
				<?php 
        }
        $wp_query = null;
        wp_reset_query();
        ?>
            </div></div>

            <?php 
    } else {
        if ($type == "post") {
            if ($columns == '3') {
                $itemsize = 'tcol-lg-4 tcol-md-4 tcol-sm-4 tcol-xs-6 tcol-ss-12';
                $slidewidth = 400;
                $slideheight = 400;
                $md = 3;
                $sm = 3;
                $xs = 2;
                $ss = 1;
            } else {
                if ($columns == '5') {
                    $itemsize = 'tcol-lg-25 tcol-md-25 tcol-sm-3 tcol-xs-4 tcol-ss-6';
                    $slidewidth = 240;
                    $slideheight = 240;
                    $md = 5;
                    $sm = 4;
                    $xs = 3;
                    $ss = 2;
                } else {
                    if ($columns == '2') {
                        $itemsize = 'tcol-lg-6 tcol-md-6 tcol-sm-6 tcol-xs-6 tcol-ss-12';
                        $slidewidth = 400;
                        $slideheight = 400;
                        $md = 2;
                        $sm = 2;
                        $xs = 2;
                        $ss = 1;
                    } else {
                        if ($columns == '1') {
                            $itemsize = 'tcol-lg-12 tcol-md-12 tcol-sm-12 tcol-xs-12 tcol-ss-12';
                            $slidewidth = 400;
                            $slideheight = 400;
                            $md = 1;
                            $sm = 1;
                            $xs = 1;
                            $ss = 1;
                        } else {
                            $itemsize = 'tcol-lg-3 tcol-md-3 tcol-sm-4 tcol-xs-6 tcol-ss-12';
                            $slidewidth = 300;
                            $slideheight = 300;
                            $md = 4;
                            $sm = 3;
                            $xs = 2;
                            $ss = 1;
                        }
                    }
                }
            }
            $wp_query = null;
            $wp_query = new WP_Query();
            $wp_query->query(array('orderby' => $orderby, 'order' => $order, 'post_type' => 'post', 'category_name' => $cat, 'posts_per_page' => $items));
            if ($wp_query) {
                while ($wp_query->have_posts()) {
                    $wp_query->the_post();
                    ?>
						<div class="<?php 
                    echo $itemsize;
                    ?>
 kad_product">
                			<div <?php 
                    global $post;
                    post_class('blog_item grid_item');
                    ?>
>
	                    		<?php 
                    if (has_post_thumbnail($post->ID)) {
                        $image_url = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full');
                        $thumbnailURL = $image_url[0];
                        $image = aq_resize($thumbnailURL, $slidewidth, $slideheight, true);
                        if (empty($image)) {
                            $image = $thumbnailURL;
                        }
                    } else {
                        $thumbnailURL = virtue_post_default_placeholder();
                        $image = aq_resize($thumbnailURL, $slidewidth, $slideheight, true);
                        if (empty($image)) {
                            $image = $thumbnailURL;
                        }
                        ?>
                             <?php 
                    }
                    ?>
									 <div class="imghoverclass">
		                           		<a href="<?php 
                    the_permalink();
                    ?>
" title="<?php 
                    the_title();
                    ?>
">
		                           			<img src="<?php 
                    echo $image;
                    ?>
" alt="<?php 
                    the_title();
                    ?>
" class="iconhover" style="display:block;">
		                           		</a> 
		                         	</div>
                           		<?php 
                    $image = null;
                    $thumbnailURL = null;
                    ?>
              					<a href="<?php 
                    the_permalink();
                    ?>
" class="bcarousellink">
				                    <header>
			                          <h5 class="entry-title"><?php 
                    the_title();
                    ?>
</h5>
			                          <div class="subhead">
			                          	<span class="postday kad-hidedate"><?php 
                    echo get_the_date('j M Y');
                    ?>
</span>
			                        </div>	
			                        </header>
		                        	<div class="entry-content color_body">
		                          		<p><?php 
                    echo strip_tags(virtue_excerpt(16));
                    if ($readmore) {
                        global $virtue_premium;
                        if (!empty($virtue_premium['post_readmore_text'])) {
                            $readmoret = $virtue_premium['post_readmore_text'];
                        } else {
                            $readmoret = __('Read More', 'virtue');
                        }
                        echo $readmoret;
                    }
                    ?>
		                          	</p>
		                        	</div>
                           		</a>
               		 </div>
				</div>
				<?php 
                }
            } else {
                ?>
				<div class="error-not-found"><?php 
                _e('Sorry, no post entries found.', 'virtue');
                ?>
</div>
				<?php 
            }
            $wp_query = null;
            wp_reset_query();
            ?>
								
				</div>
				</div>
            <?php 
        } else {
            if ($type == "featured-products") {
                global $woocommerce_loop;
                if ($columns == 1) {
                    $md = 1;
                    $sm = 1;
                    $xs = 1;
                    $ss = 1;
                    $woocommerce_loop['columns'] = 3;
                } else {
                    $woocommerce_loop['columns'] = $columns;
                    if ($columns == '2') {
                        $md = 2;
                        $sm = 2;
                        $xs = 1;
                        $ss = 1;
                    } else {
                        if ($columns == '3') {
                            $md = 3;
                            $sm = 3;
                            $xs = 2;
                            $ss = 1;
                        } else {
                            if ($columns == '6') {
                                $md = 6;
                                $sm = 4;
                                $xs = 3;
                                $ss = 2;
                            } else {
                                if ($columns == '5') {
                                    $md = 5;
                                    $sm = 4;
                                    $xs = 3;
                                    $ss = 2;
                                } else {
                                    $md = 4;
                                    $sm = 3;
                                    $xs = 3;
                                    $ss = 1;
                                }
                            }
                        }
                    }
                }
                $wp_query = null;
                $wp_query = new WP_Query();
                $wp_query->query(array('post_type' => 'product', 'meta_key' => '_featured', 'meta_value' => 'yes', 'post_status' => 'publish', 'orderby' => 'menu_order', 'posts_per_page' => $items));
                if ($wp_query) {
                    while ($wp_query->have_posts()) {
                        $wp_query->the_post();
                        ?>
					<?php 
                        woocommerce_get_template_part('content', 'product');
                        ?>
					<?php 
                    }
                    ?>
					<?php 
                }
                ?>
         
                    <?php 
                $wp_query = null;
                wp_reset_query();
                ?>
				</div>
				</div>
           <?php 
            } else {
                if ($type == "sale-products") {
                    if (class_exists('woocommerce')) {
                        global $woocommerce, $woocommerce_loop;
                        $product_ids_on_sale = woocommerce_get_product_ids_on_sale();
                        $product_ids_on_sale[] = 0;
                        $meta_query = array();
                        $meta_query[] = $woocommerce->query->visibility_meta_query();
                        $meta_query[] = $woocommerce->query->stock_status_meta_query();
                    }
                    if ($columns == 1) {
                        $md = 1;
                        $sm = 1;
                        $xs = 1;
                        $ss = 1;
                        $woocommerce_loop['columns'] = 3;
                    } else {
                        $woocommerce_loop['columns'] = $columns;
                        if ($columns == '2') {
                            $md = 2;
                            $sm = 2;
                            $xs = 1;
                            $ss = 1;
                        } else {
                            if ($columns == '3') {
                                $md = 3;
                                $sm = 3;
                                $xs = 2;
                                $ss = 1;
                            } else {
                                if ($columns == '6') {
                                    $md = 6;
                                    $sm = 4;
                                    $xs = 3;
                                    $ss = 2;
                                } else {
                                    if ($columns == '5') {
                                        $md = 5;
                                        $sm = 4;
                                        $xs = 3;
                                        $ss = 2;
                                    } else {
                                        $md = 4;
                                        $sm = 3;
                                        $xs = 3;
                                        $ss = 1;
                                    }
                                }
                            }
                        }
                    }
                    if (!empty($cat)) {
                        $product_category = $cat;
                    } else {
                        $product_category = '';
                    }
                    $wp_query = null;
                    $wp_query = new WP_Query();
                    $wp_query->query(array('post_type' => 'product', 'meta_query' => $meta_query, 'post__in' => $product_ids_on_sale, 'post_status' => 'publish', 'product_cat' => $product_category, 'orderby' => 'menu_order', 'posts_per_page' => $items));
                    if ($wp_query) {
                        while ($wp_query->have_posts()) {
                            $wp_query->the_post();
                            ?>
					<?php 
                            woocommerce_get_template_part('content', 'product');
                            ?>
					<?php 
                        }
                        ?>
					<?php 
                    }
                    ?>
         
                    <?php 
                    $wp_query = null;
                    wp_reset_query();
                    ?>
				</div>
				</div>
           <?php 
                } else {
                    if ($type == "best-products") {
                        global $woocommerce_loop;
                        if ($columns == 1) {
                            $md = 1;
                            $sm = 1;
                            $xs = 1;
                            $ss = 1;
                            $woocommerce_loop['columns'] = 3;
                        } else {
                            $woocommerce_loop['columns'] = $columns;
                            if ($columns == '2') {
                                $md = 2;
                                $sm = 2;
                                $xs = 1;
                                $ss = 1;
                            } else {
                                if ($columns == '3') {
                                    $md = 3;
                                    $sm = 3;
                                    $xs = 2;
                                    $ss = 1;
                                } else {
                                    if ($columns == '6') {
                                        $md = 6;
                                        $sm = 4;
                                        $xs = 3;
                                        $ss = 2;
                                    } else {
                                        if ($columns == '5') {
                                            $md = 5;
                                            $sm = 4;
                                            $xs = 3;
                                            $ss = 2;
                                        } else {
                                            $md = 4;
                                            $sm = 3;
                                            $xs = 3;
                                            $ss = 1;
                                        }
                                    }
                                }
                            }
                        }
                        $wp_query = null;
                        $wp_query = new WP_Query();
                        $wp_query->query(array('post_type' => 'product', 'meta_key' => 'total_sales', 'orderby' => 'meta_value_num', 'post_status' => 'publish', 'posts_per_page' => $items));
                        if ($wp_query) {
                            while ($wp_query->have_posts()) {
                                $wp_query->the_post();
                                ?>
					<?php 
                                woocommerce_get_template_part('content', 'product');
                                ?>
					<?php 
                            }
                            ?>
					<?php 
                        }
                        ?>
         
                    <?php 
                        $wp_query = null;
                        wp_reset_query();
                        ?>
				</div>
				</div>
            <?php 
                    } else {
                        if ($type == "cat-products") {
                            global $woocommerce_loop;
                            if ($columns == 1) {
                                $md = 1;
                                $sm = 1;
                                $xs = 1;
                                $ss = 1;
                                $woocommerce_loop['columns'] = 3;
                            } else {
                                $woocommerce_loop['columns'] = $columns;
                                if ($columns == '2') {
                                    $md = 2;
                                    $sm = 2;
                                    $xs = 1;
                                    $ss = 1;
                                } else {
                                    if ($columns == '3') {
                                        $md = 3;
                                        $sm = 3;
                                        $xs = 2;
                                        $ss = 1;
                                    } else {
                                        if ($columns == '6') {
                                            $md = 6;
                                            $sm = 4;
                                            $xs = 3;
                                            $ss = 2;
                                        } else {
                                            if ($columns == '5') {
                                                $md = 5;
                                                $sm = 4;
                                                $xs = 3;
                                                $ss = 2;
                                            } else {
                                                $md = 4;
                                                $sm = 3;
                                                $xs = 3;
                                                $ss = 1;
                                            }
                                        }
                                    }
                                }
                            }
                            if (!empty($cat)) {
                                $product_category = $cat;
                            } else {
                                $product_category = '';
                            }
                            $wp_query = null;
                            $wp_query = new WP_Query();
                            $wp_query->query(array('post_type' => 'product', 'orderby' => $orderby, 'order' => $order, 'product_cat' => $product_category, 'post_status' => 'publish', 'posts_per_page' => $items));
                            if ($wp_query) {
                                while ($wp_query->have_posts()) {
                                    $wp_query->the_post();
                                    ?>
					<?php 
                                    woocommerce_get_template_part('content', 'product');
                                    ?>
					<?php 
                                }
                                ?>
					<?php 
                            }
                            ?>
         
                    <?php 
                            $wp_query = null;
                            wp_reset_query();
                            ?>
				</div>
				</div>
           <?php 
                        }
                    }
                }
            }
        }
    }
    ?>
			<div class="clearfix"></div>
            <a id="prevport-<?php 
    echo $carousel_rn;
    ?>
" class="prev_carousel icon-arrow-left" href="#"></a>
			<a id="nextport-<?php 
    echo $carousel_rn;
    ?>
" class="next_carousel icon-arrow-right" href="#"></a>
			</div></div>
			<script type="text/javascript"> jQuery( window ).load(function () {var $wcontainer = jQuery('#carouselcontainer-<?php 
    echo $carousel_rn;
    ?>
'); var $container = jQuery('#carousel-<?php 
    echo $carousel_rn;
    ?>
');
	 				setWidths(); 
	 				function init_Carousel_widget() {
	 					$container.carouFredSel({
							scroll: { <?php 
    echo $scroll;
    ?>
 easing: "swing", duration: 700, pauseOnHover : true}, auto: {play: true, timeoutDuration: <?php 
    echo $speed;
    ?>
},
							prev: '#prevport-<?php 
    echo $carousel_rn;
    ?>
', next: '#nextport-<?php 
    echo $carousel_rn;
    ?>
', pagination: false, swipe: true, items: {visible: null}
						});
	 					}
	 					init_Carousel_widget();
		 				jQuery(window).on("debouncedresize", function( event ) {
		 					$container.trigger("destroy");
		 					setWidths();
		 					init_Carousel_widget();
						});
		 			$wcontainer.animate({'opacity' : 1});
					function getUnitWidth() {var width;
					if(jQuery(window).width() <= 540) {
					width = $wcontainer.width() / <?php 
    echo $ss;
    ?>
;
					} else if(jQuery(window).width() <= 768) {
					width = $wcontainer.width() / <?php 
    echo $xs;
    ?>
;
					} else if(jQuery(window).width() <= 990) {
					width = $wcontainer.width() / <?php 
    echo $sm;
    ?>
;
					} else {
					width = $wcontainer.width() / <?php 
    echo $md;
    ?>
;
					}
					return width;
					}
					function setWidths() {
					var unitWidth = getUnitWidth() -1;
					$container.children().css({ width: unitWidth });
					} });
			</script>				

	<?php 
    $output = ob_get_contents();
    ob_end_clean();
    return $output;
}
Example #7
0
			                          				<span class="kad-hidepostedin">|</span>
			                        				<span class="postcommentscount" data-toggle="tooltip" data-placement="top" data-original-title="<?php 
            $num_comments = get_comments_number();
            echo esc_attr($num_comments);
            ?>
">
			                        					<i class="icon-comments-alt"></i>
			                        				</span>
			                        			<?php 
        }
        ?>
			                        		</div>
			                        </header>
		                        	<div class="entry-content">
		                          		<p><?php 
        echo virtue_excerpt(34);
        ?>
 <a href="<?php 
        the_permalink();
        ?>
"><?php 
        _e('READ MORE', 'virtue');
        ?>
</a></p>
		                        	</div>
		                      		<footer>
                       				</footer>
							</div>
	                   	</div>
                    </article>
                </div>
Example #8
0
function kad_blog_shortcode_function($atts, $content)
{
    extract(shortcode_atts(array('orderby' => '', 'type' => '', 'speed' => '', 'height' => '', 'width' => '', 'offset' => null, 'cat' => '', 'word_count' => '', 'items' => ''), $atts));
    $carousel_rn = rand(10, 100);
    if (empty($orderby)) {
        $orderby = 'date';
    }
    if ($orderby == 'menu_order') {
        $order = 'ASC';
    } else {
        $order = 'DESC';
    }
    if (empty($items)) {
        $items = '4';
    }
    if (empty($word_count)) {
        $word_count = '36';
    }
    if (empty($cat)) {
        $cat = '';
    }
    if (!empty($type) && $type == 'slider') {
        ob_start();
        ?>
		<div class="sliderclass">
  <?php 
        global $virtue_premium;
        if (!empty($height)) {
            $slideheight = $height;
        } else {
            $slideheight = 400;
        }
        if (!empty($width)) {
            $slidewidth = $width;
        } else {
            $slidewidth = 1140;
        }
        if (empty($speed)) {
            $speed = '7000';
        }
        ?>
          <div class="flexslider kt-flexslider loading" style="max-width:<?php 
        echo esc_attr($slidewidth);
        ?>
px; margin-left: auto; margin-right:auto;" data-flex-speed="<?php 
        echo esc_attr($speed);
        ?>
" data-flex-initdelay="0" data-flex-anim-speed="400" data-flex-animation="fade" data-flex-auto="true">
            <ul class="slides">
    <?php 
        $wp_query = null;
        $wp_query = new WP_Query();
        $wp_query->query(array('orderby' => $orderby, 'order' => $order, 'offset' => $offset, 'post_type' => 'post', 'category_name' => $cat, 'posts_per_page' => $items));
        if ($wp_query) {
            while ($wp_query->have_posts()) {
                $wp_query->the_post();
                global $post;
                if (has_post_thumbnail($post->ID)) {
                    $image_url = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full');
                    $thumbnailURL = $image_url[0];
                    $image = aq_resize($thumbnailURL, $slidewidth, $slideheight, true);
                    if (empty($image)) {
                        $image = $thumbnailURL;
                    }
                } else {
                    $thumbnailURL = virtue_post_default_placeholder();
                    $image = aq_resize($thumbnailURL, $slidewidth, $slideheight, true);
                    if (empty($image)) {
                        $image = $thumbnailURL;
                    }
                    ?>
                  <?php 
                }
                ?>
                      <li> 
                        <a href="<?php 
                the_permalink();
                ?>
">
                          <img src="<?php 
                echo esc_url($image);
                ?>
" alt="<?php 
                the_title();
                ?>
" />
                                <div class="flex-caption">
                                <div class="captiontitle headerfont"><?php 
                the_title();
                ?>
</div>
                                </div> 
                        </a>
                      </li>
                  <?php 
            }
        } else {
            ?>
            <li class="error-not-found"><?php 
            _e('Sorry, no blog entries found.', 'virtue');
            ?>
</li>
          <?php 
        }
        ?>
        <?php 
        $wp_query = null;
        // Reset
        ?>
        <?php 
        wp_reset_query();
        ?>
        </ul>
      </div> <!--Flex Slides-->
  </div> <!--Slider Class-->
<?php 
        $output = ob_get_contents();
        ob_end_clean();
        return $output;
    } else {
        ob_start();
        ?>
				<div class="home_blog kad-animation" data-animation="fade-in" data-delay="0">
				<?php 
        if (kadence_display_sidebar()) {
            $home_sidebar = true;
            $img_width = 407;
            $postwidthclass = 'col-md-6 col-sm-6 home-sidebar';
        } else {
            $home_sidebar = false;
            $img_width = 270;
            $postwidthclass = 'col-md-6 col-sm-6';
        }
        ?>
				<div class="row">
            		<?php 
        $xyz = '0';
        $wp_query = null;
        $wp_query = new WP_Query();
        $wp_query->query(array('orderby' => $orderby, 'order' => $order, 'offset' => $offset, 'post_type' => 'post', 'category_name' => $cat, 'posts_per_page' => $items));
        if ($wp_query) {
            while ($wp_query->have_posts()) {
                $wp_query->the_post();
                ?>
						<div class="<?php 
                echo esc_attr($postwidthclass);
                ?>
 clearclass<?php 
                echo $xyz++ % 2;
                ?>
">
				  	<article id="post-<?php 
                the_ID();
                ?>
" <?php 
                post_class();
                ?>
>
	                    <div class="rowtight">
	                    <?php 
                global $post, $virtue_premium;
                if (isset($virtue_premium['post_summery_default']) && $virtue_premium['post_summery_default'] != 'text') {
                    if ($home_sidebar == true) {
                        $textsize = 'tcol-md-12 tcol-sm-12 tcol-ss-12';
                        $imagesize = 'tcol-md-12 tcol-sm-12 tcol-ss-12';
                    } else {
                        $textsize = 'tcol-md-7 tcol-sm-12 tcol-ss-12';
                        $imagesize = 'tcol-md-5 tcol-sm-12 tcol-ss-12';
                    }
                    if (has_post_thumbnail($post->ID)) {
                        $image_url = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full');
                        $thumbnailURL = $image_url[0];
                        $image = aq_resize($thumbnailURL, $img_width, 270, true);
                        if (empty($image)) {
                            $image = $thumbnailURL;
                        }
                    } else {
                        $thumbnailURL = virtue_post_default_placeholder();
                        $image = aq_resize($thumbnailURL, $img_width, 270, true);
                        if (empty($image)) {
                            $image = $thumbnailURL;
                        }
                    }
                    ?>
								 <div class="<?php 
                    echo $imagesize;
                    ?>
">
									 <div class="imghoverclass">
		                           		<a href="<?php 
                    the_permalink();
                    ?>
" title="<?php 
                    the_title();
                    ?>
">
		                           			<img src="<?php 
                    echo $image;
                    ?>
" alt="<?php 
                    the_title();
                    ?>
" class="iconhover" style="display:block;">
		                           		</a> 
		                             </div>
		                         </div>

                           		<?php 
                    $image = null;
                    $thumbnailURL = null;
                    ?>
 
                        <?php 
                } else {
                    if (has_post_thumbnail($post->ID)) {
                        if ($home_sidebar == true) {
                            $textsize = 'tcol-md-12 tcol-sm-12 tcol-ss-12';
                            $imagesize = 'tcol-md-12 tcol-sm-12 tcol-ss-12';
                        } else {
                            $textsize = 'tcol-md-7 tcol-sm-12 tcol-ss-12';
                            $imagesize = 'tcol-md-5 tcol-sm-12 tcol-ss-12';
                        }
                        $image_url = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full');
                        $thumbnailURL = $image_url[0];
                        $image = aq_resize($thumbnailURL, $img_width, 270, true);
                        if (empty($image)) {
                            $image = $thumbnailURL;
                        }
                        ?>
								 		<div class="<?php 
                        echo $imagesize;
                        ?>
">
										 <div class="imghoverclass">
			                           		<a href="<?php 
                        the_permalink();
                        ?>
" title="<?php 
                        the_title();
                        ?>
">
			                           			<img src="<?php 
                        echo $image;
                        ?>
" alt="<?php 
                        the_title();
                        ?>
"  width="<?php 
                        echo esc_attr($img_width);
                        ?>
" height="270" class="iconhover" style="display:block;">
			                           		</a> 
			                             </div>
			                         	</div>
 										<?php 
                        $image = null;
                        $thumbnailURL = null;
                        ?>
 
		                       <?php 
                    } else {
                        $textsize = 'tcol-md-12 tcol-ss-12';
                    }
                }
                ?>
	                       		<div class="<?php 
                echo $textsize;
                ?>
 postcontent">
	                       			<div class="postmeta color_gray">
				                        	<div class="postdate bg-lightgray headerfont">
				                        		<span class="postday"><?php 
                echo get_the_date('j');
                ?>
</span>
				                        		<?php 
                echo get_the_date('M Y');
                ?>
				                        	</div>
				                            
				                        </div>
				                    <header class="home_blog_title">
			                          <a href="<?php 
                the_permalink();
                ?>
"><h5 class="entry-title"><?php 
                the_title();
                ?>
</h5></a>
			                          <div class="subhead color_gray">
			                          	<span class="postauthortop" rel="tooltip" data-placement="top" data-original-title="<?php 
                echo get_the_author();
                ?>
">
			                          		<i class="icon-user"></i>
			                          	</span>
			                          	<span class="kad-hidepostauthortop"> | </span>
			                          		<?php 
                $post_category = get_the_category($post->ID);
                if (!empty($post_category)) {
                    ?>
 
			                          		<span class="postedintop" rel="tooltip" data-placement="top" data-original-title="<?php 
                    foreach ($post_category as $category) {
                        echo $category->name . '&nbsp;';
                    }
                    ?>
"><i class="icon-folder"></i></span>
			                          		 <?php 
                }
                ?>
			                          		 <?php 
                if (comments_open() || get_comments_number() != 0) {
                    ?>
  
			                          	<span class="kad-hidepostedin">|</span>
			                        	<span class="postcommentscount" rel="tooltip" data-placement="top" data-original-title="<?php 
                    esc_attr(get_comments_number());
                    ?>
">
			                        		<i class="icon-bubbles"></i>
			                        	</span>
			                        	 <?php 
                }
                ?>
			                        </div>
			                        </header>
		                        	<div class="entry-content">
		                          		<p><?php 
                echo virtue_excerpt($word_count);
                ?>
 <a href="<?php 
                the_permalink();
                ?>
">
		                          			<?php 
                global $virtue_premium;
                if (!empty($virtue_premium['post_readmore_text'])) {
                    $readmore = $virtue_premium['post_readmore_text'];
                } else {
                    $readmore = __('Read More', 'virtue');
                }
                echo $readmore;
                ?>
</a></p>
		                        	</div>
		                      		<footer>
                       				</footer>
							</div>
	                   	</div>
                    </article>
                </div>
                    <?php 
            }
        } else {
            ?>
						<li class="error-not-found"><?php 
            _e('Sorry, no blog entries found.', 'virtue');
            ?>
</li>
					<?php 
        }
        ?>
				<?php 
        $wp_query = null;
        wp_reset_query();
        ?>

	</div>
</div> <!--home-blog -->
            		

	<?php 
        $output = ob_get_contents();
        ob_end_clean();
        return $output;
    }
}