function woocommerce_product_taxonomy_content()
    {
        global $wp_query;
        $term = get_term_by('slug', get_query_var($wp_query->query_vars['taxonomy']), $wp_query->query_vars['taxonomy']);
        ?>
<h1 class="page-title"><?php 
        echo wptexturize($term->name);
        ?>
</h1>
			
		<?php 
        if ($term->description) {
            ?>
		
			<div class="term_description"><?php 
            echo wpautop(wptexturize($term->description));
            ?>
</div>
			
		<?php 
        }
        ?>
		
		<?php 
        woocommerce_get_template_part('loop', 'shop');
        ?>
		
		<?php 
        do_action('woocommerce_pagination');
    }
Пример #2
0
    /**
     * Front-end display of widget.
     *
     * @see WP_Widget::widget()
     *
     * @param array $args     Widget arguments.
     * @param array $instance Saved values from database.
     */
    public function widget($args, $instance)
    {
        global $product, $woocommerce, $woocommerce_loop;
        /* Disable if not on product page */
        if (!is_product()) {
            return;
        }
        $upsells = $product->get_upsells();
        if (sizeof($upsells) == 0) {
            return;
        }
        extract($args);
        $title = apply_filters('widget_title', $instance['title']);
        $meta_query = $woocommerce->query->get_meta_query();
        $args = array('post_type' => 'product', 'ignore_sticky_posts' => 1, 'no_found_rows' => 1, 'posts_per_page' => 9, 'orderby' => 'rand', 'post__in' => $upsells, 'post__not_in' => array($product->id), 'meta_query' => $meta_query);
        $products = new WP_Query($args);
        echo $before_widget;
        if ($products->have_posts()) {
            if (!empty($title)) {
                echo $before_title . $title . $after_title;
            }
            ?>

		<ul class="large-block-grid-2 up-sell">
		<?php 
            while ($products->have_posts()) {
                $products->the_post();
                ?>

				<?php 
                woocommerce_get_template_part('content', 'product-small');
                ?>

		<?php 
            }
            // end of the loop.
            ?>

		</ul>
		<?php 
            // Reset the global $the_post as this query will have stomped on it
            wp_reset_postdata();
        }
        echo $after_widget;
    }
Пример #3
0
if (have_posts()) {
    global $wp_query;
    $title = '';
    if (isset($wp_query->query_vars['taxonomy']) && $wp_query->query_vars['taxonomy'] === 'product_cat') {
        $title = sprintf(__('Product Category : <b>%s</b>', 'jeg_textdomain'), single_cat_title('', false));
    } else {
        if (isset($wp_query->query_vars['taxonomy']) && $wp_query->query_vars['taxonomy'] === 'product_tag') {
            $title = sprintf(__('Product Tag : <b>%s</b>', 'jeg_textdomain'), single_tag_title('', false));
        }
    }
    if ($title !== '') {
        echo "<a href='#' class='productitem productcategorywrapout' data-width='1'>\r\n\t\t\t\t\t\t\t<div class='productcontent productcategorywrap' style='margin: {$marginsize}px'>\r\n\t\t\t\t\t\t\t\t<div class='article-head-wrapper'>\r\n\t\t\t\t\t\t\t\t\t<span>{$title}</span>\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t</div>\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t</a>";
    }
    while (have_posts()) {
        the_post();
        woocommerce_get_template_part('content', 'product');
    }
} else {
    woocommerce_get_template('loop/no-products-found.php');
}
?>
		</div>
		<?php 
global $wp_query;
$paged = get_query_var('paged') ? get_query_var('paged') : 1;
if ($wp_query->max_num_pages > 1) {
    echo "<div class='blogpagingholder'>\r\n\t\t\t\t\t<div class='blogpagingwrapper'>\r\n\t\t\t\t\t" . jeg_new_pagination(get_the_ID(), $paged, $wp_query->max_num_pages) . "\r\n\t\t\t\t\t</div>\r\n\t\t\t\t</div>";
}
wp_reset_postdata();
?>
		
Пример #4
0
    public function widget($args, $instance)
    {
        extract($args);
        $product_alignment = $instance['product_alignment'];
        $product_category = $instance['product_category'];
        $product_args = array('post_type' => 'product', 'tax_query' => array(array('taxonomy' => 'product_cat', 'field' => 'id', 'terms' => $product_category)), 'posts_per_page' => '6');
        ?>
        <section class="category_product">
            <div class="ak-container">
                <?php 
        echo $before_widget;
        ?>
                <div class="feature-cat-product-wrap">
                <?php 
        //if($product_alignment == 'left_align'):
        ?>
                    <div class="feature-cat-image <?php 
        echo $product_alignment;
        ?>
">
                        <?php 
        $thumbnail_id = get_woocommerce_term_meta($product_category, 'thumbnail_id', true);
        if (!empty($thumbnail_id)) {
            $image = wp_get_attachment_image_src($thumbnail_id, 'prod-cat-size');
            echo '<img src="' . esc_url($image[0]) . '" alt="asfds"  />';
        } else {
            ?>
                        <img src="<?php 
            echo get_template_directory_uri() . '../images/dummy-cat.jpg';
            ?>
"/>
                        <?php 
        }
        ?>
                        <div class="product-cat-desc">
                            <?php 
        $taxonomy = 'product_cat';
        $terms = term_description($product_category, $taxonomy);
        $terms_name = get_term($product_category, $taxonomy);
        ?>
                            <h3><?php 
        echo $terms_name->name;
        ?>
</h3>
                            <div class="cat_desc">  
                            <?php 
        echo $terms;
        ?>
   
                            </div>  
                        </div>
                    </div>
                <?php 
        //endif;
        ?>
                    <div class="feature-cat-product <?php 
        echo $product_alignment;
        ?>
">
                        <?php 
        $prod_args = array('post_type' => 'product', 'tax_query' => array(array('taxonomy' => 'product_cat', 'field' => 'id', 'terms' => $product_category)), 'posts_per_page' => '6');
        $product_query = new WP_Query($prod_args);
        if ($product_query->have_posts()) {
            $count = 1;
            while ($product_query->have_posts()) {
                $product_query->the_post();
                $image_id = get_post_thumbnail_id();
                $image = wp_get_attachment_image_src($image_id, 'thumbnail', 'true');
                ?>
                                        <div class="feature-prod-wrap wow flipInY" data-wow-delay="<?php 
                echo $count;
                ?>
s">
                                            <?php 
                woocommerce_get_template_part('content', 'feat-product');
                ?>
                                        </div>
                                    <?php 
                $count += 0.5;
            }
        }
        ?>
                    </div>
                    
                    <?php 
        /*($product_alignment == 'right_align'): ?>
              <div class="feature-cat-image">
                  <?php 
                  $thumbnail_id = get_woocommerce_term_meta($product_category, 'thumbnail_id', true);
                  if (!empty($thumbnail_id)) {
                      $image = wp_get_attachment_image_src($thumbnail_id, 'prod-cat-size');
                      echo '<img src="' . esc_url($image[0]) . '" alt="asfds"  />';
                  }
                  else{ ?>
                  <img src="<?php echo get_template_directory_uri().'../images/dummy-cat.jpg'?>"/><?php } ?>
                  <div class="product-cat-desc">
                      <?php 
                      
                      $taxonomy = 'product_cat';
                      $terms = term_description( $product_category, $taxonomy ); 
                       $terms_name = get_term( $product_category, $taxonomy );
                      ?>
                      <h3><?php echo $terms_name->name ?></h3>
                      <div class="cat_desc">  
                      <?php echo $terms; ?>   
                      </div>     
                  </div>
              </div>
          <?php endif; */
        ?>
                    
                </div>
                
                
                
                <?php 
        echo $after_widget;
        ?>
            </div>
        </section>
        <?php 
    }
Пример #5
0
function cg_woo_featured_products($atts, $content = null)
{
    global $woocommerce;
    $owlid = rand();
    extract(shortcode_atts(array("introtext" => 'Recommended for you', 'products' => '12', 'orderby' => 'date', 'order' => 'desc'), $atts));
    ob_start();
    ?>
    
    <?php 
    /**
     * Check if WooCommerce is active
     **/
    if (in_array('woocommerce/woocommerce.php', apply_filters('active_plugins', get_option('active_plugins')))) {
        ?>
    
    <!-- Open CommerceGurus featured Products  -->
 	<?php 
        cg_owlslider_js($owlid);
        ?>

	<section class="slider">
		<div class="row">
			<div class="col-lg-12">
				<div class="titlewrap">
					<h2><?php 
        echo $introtext;
        ?>
</h2>
				</div>
			</div>
			<div id="owlslider_<?php 
        echo $owlid;
        ?>
" class="owl-carousel">
				<?php 
        $args = array('post_status' => 'publish', 'post_type' => 'product', 'ignore_sticky_posts' => 1, 'meta_key' => '_featured', 'meta_value' => 'yes', 'posts_per_page' => $products, 'orderby' => $orderby, 'order' => $order);
        // Hide hidden items
        $args['meta_query'][] = WC()->query->visibility_meta_query();
        $products = new WP_Query($args);
        if ($products->have_posts()) {
            ?>
				            
				    <?php 
            while ($products->have_posts()) {
                $products->the_post();
                ?>

				    	<div class="item">
				    	<ul>
				    		<?php 
                woocommerce_get_template_part('content', 'product');
                ?>
				    	</ul>
				    	</div>

				    <?php 
            }
            // end of the loop.
            ?>
				    
				<?php 
        }
        wp_reset_query();
        ?>
			</div>
		</div>
	</section>

    <!-- Close CommerceGurus featured Products  -->

    <?php 
    }
    ?>

	<?php 
    $content = ob_get_contents();
    ob_end_clean();
    return $content;
}
Пример #6
0
/**
 * Output featured products
 **/
function woocommerce_featured_products($atts)
{
    global $woocommerce_loop;
    extract(shortcode_atts(array('per_page' => '12', 'columns' => '4', 'orderby' => 'date', 'order' => 'desc'), $atts));
    $woocommerce_loop['columns'] = $columns;
    $args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $per_page, 'orderby' => $orderby, 'order' => $order, 'meta_query' => array(array('key' => '_visibility', 'value' => array('catalog', 'visible'), 'compare' => 'IN'), array('key' => '_featured', 'value' => 'yes')));
    query_posts($args);
    ob_start();
    woocommerce_get_template_part('loop', 'shop');
    wp_reset_query();
    return ob_get_clean();
}
        public function widget($args, $instance)
        {
            extract($args);
            if ($instance) {
                $product_alignment = $instance['product_alignment'];
                $product_category = $instance['product_category'];
                $product_args = array('post_type' => 'product', 'tax_query' => array(array('taxonomy' => 'product_cat', 'field' => 'id', 'terms' => $product_category)), 'posts_per_page' => '6');
                ?>
        <section class="category_product">
          <div class="store-wrapper">
            <?php 
                echo $before_widget;
                ?>
            <div class="feature-cat-product-wrap">
              <?php 
                $woo_cat_id_int = (int) $product_category;
                $terms_link = get_term_link($woo_cat_id_int, 'product_cat');
                ?>
              <a href="<?php 
                echo esc_url($terms_link);
                ?>
">
                <div class="feature-cat-image">
                  <?php 
                $thumbnail_id = get_woocommerce_term_meta($product_category, 'thumbnail_id', true);
                if (!empty($thumbnail_id)) {
                    $image = wp_get_attachment_image_src($thumbnail_id, 'prod-cat-size');
                    echo '<img src="' . esc_url($image[0]) . '" alt="' . esc_attr__('Category Image', 'eightstore-lite') . '"  />';
                } else {
                    ?>
                    <img src="<?php 
                    echo get_template_directory_uri() . '/images/dummy-cat.jpg';
                    ?>
"/>
                    <?php 
                }
                ?>
                  <div class="product-cat-desc">
                    <?php 
                $taxonomy = 'product_cat';
                $terms = term_description($product_category, $taxonomy);
                $terms_name = get_term($product_category, $taxonomy);
                ?>
                    <h3><?php 
                echo $terms_name->name;
                ?>
</h3>
                    <div class="cat_desc">  
                      <?php 
                echo $terms;
                ?>
   
                    </div>  
                  </div>
                </div>
              </a>
              <ul class="feature-cat-product">
                <?php 
                $prod_args = array('post_type' => 'product', 'tax_query' => array(array('taxonomy' => 'product_cat', 'field' => 'id', 'terms' => $product_category)), 'posts_per_page' => '6');
                $product_query = new WP_Query($prod_args);
                if ($product_query->have_posts()) {
                    $count = 1;
                    while ($product_query->have_posts()) {
                        $product_query->the_post();
                        $image_id = get_post_thumbnail_id();
                        $image = wp_get_attachment_image_src($image_id, 'thumbnail', 'true');
                        ?>
                <?php 
                        woocommerce_get_template_part('content', 'product');
                        ?>
                <?php 
                        $count += 0.5;
                    }
                }
                ?>
              </ul>
            </div>
            <?php 
                echo $after_widget;
                ?>
          </div>
        </section>
        <?php 
            }
        }
			</div>
		</div>
	</div>

	<div class="suggested-products">
		<h1>You May Also Like…</h1>
		<div class="wrapper wrap">
			<div id="carousel-featured" class="suggested-products-slide flexslider">
				<ul class="slides">
					<?php 
$args = array('post_type' => 'product', 'meta_key' => '_featured', 'meta_value' => 'yes', 'posts_per_page' => 15);
$loop = new WP_Query($args);
if ($loop->have_posts()) {
    while ($loop->have_posts()) {
        $loop->the_post();
        woocommerce_get_template_part('content', 'productfeatured');
    }
} else {
    ?>
	
						<li>No products here</li>	
					<?php 
}
wp_reset_postdata();
?>
		 		</ul>
			</div>
		</div>
	</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;
}
Пример #10
0
 /**
  * This function creates the html code necessary for a woocommerce shop section. It uses the woocommerce shop loop to do that
  *
  * @param array $element is an array with all the data necessary for creating the html code (it contains the element data and the saved values for the element)
  * @return string $output the string returned contains the html code generated within the method
  */
 function shop($element)
 {
     $output = "";
     //check if the plugin is enabled
     if (!avia_woocommerce_enabled()) {
         $url = network_site_url('wp-admin/plugin-install.php?tab=search&type=term&s=WooCommerce&plugin-search-input=Search+Plugins');
         $output = "<p><strong>You need to install and activate the <a href='{$url}'>WooCommerce Shop Plugin</a> to display Products</strong></p>";
         return $output;
     }
     extract($element['saved_value'][0]);
     global $avia_config, $more, $woocommerce_loop;
     if ($shop_columns == 5 && strpos($avia_config['layout'], 'dual') !== false) {
         $shop_columns = 4;
     }
     if ($shop_text == 'yes') {
         $avia_config['shop_overview_excerpt'] = 'active';
     }
     $woocommerce_loop['columns'] = $avia_config['shop_overview_column'] = $shop_columns;
     $order = get_option('woocommerce_default_catalog_orderby');
     if (!$order) {
         $order = "menu_order";
     }
     $avia_config['new_query'] = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, "paged" => get_query_var('paged'), 'posts_per_page' => $shop_item_count, 'orderby' => $order, 'order' => 'desc', 'meta_query' => array(array('key' => '_visibility', 'value' => array('catalog', 'visible'), 'compare' => 'IN')));
     if (empty($shop_cats_dynamic) || $shop_cats_dynamic == 'null') {
         $avia_config['new_query']['post_type'] = "product";
     } else {
         $avia_config['new_query']['tax_query'] = array(array('taxonomy' => 'product_cat', 'field' => 'id', 'terms' => explode(',', $shop_cats_dynamic), 'operator' => 'IN'));
     }
     query_posts($avia_config['new_query']);
     ob_start();
     if (have_posts()) {
         do_action('woocommerce_before_shop_loop');
         echo '<ul class="products">';
         woocommerce_product_subcategories();
         while (have_posts()) {
             the_post();
             woocommerce_get_template_part('content', 'product');
         }
         // end of the loop.
         echo '</ul>';
         do_action('woocommerce_after_shop_loop');
     } else {
         if (!woocommerce_product_subcategories(array('before' => '<ul class="products">', 'after' => '</ul>'))) {
             echo "<p>" . __('No products found which match your selection.', 'woocommerce') . "</p>";
         }
     }
     echo '<div class="clear"></div>';
     $products = ob_get_clean();
     $output .= "<div class='container_wrap " . $avia_config['layout'] . " template-shop shop_columns_" . $avia_config['shop_overview_column'] . "'>";
     $output .= "<div class='template-shop content shop_slider_{$shop_slider}' data-interval='{$shop_autorotate}'>";
     $output .= $products;
     if ($shop_pagination == 'yes') {
         $output .= avia_pagination();
     }
     $output .= "</div>";
     $output .= "</div>";
     wp_reset_query();
     return $output;
 }
Пример #11
0
function ux_products($atts, $content = null, $tag)
{
    global $woocommerce;
    $sliderrandomid = rand();
    extract(shortcode_atts(array('title' => '', 'products' => '8', 'columns' => '4', 'orderby' => '', 'type' => 'slider', 'cat' => '', 'show' => '', 'tags' => '', 'ids' => '', 'infinitive' => 'true', 'auto_slide' => 'false', 'bullets' => 'false', 'arrows' => 'true'), $atts));
    if ($tag == 'ux_bestseller_products') {
        if (!$orderby) {
            $atts['orderby'] = 'sales';
        }
    } else {
        if ($tag == 'ux_featured_products') {
            $atts['show'] = 'featured';
        } else {
            if ($tag == 'ux_sale_products') {
                $atts['show'] = 'onsale';
            } else {
                if ($tag == 'ux_custom_products') {
                } else {
                    if ($tag == 'product_lookbook') {
                        $type = 'lookbook';
                    } else {
                        if ($tag == 'products_pinterest_style') {
                            $type = 'masonry';
                            if ($products == '8') {
                                $atts['products'] = '999';
                                $columns = '3';
                            }
                        }
                    }
                }
            }
        }
    }
    if ($type == 'lookbook') {
        $infinitive = 'true';
    }
    ob_start();
    ?>
    
		<?php 
    if ($title) {
        ?>
 
		<div class="row">
			<div class="large-12 columns">
				<h3 class="section-title"><span><?php 
        echo $title;
        ?>
</span></h3>
			</div>
		</div><!-- end .title -->
		<?php 
    }
    ?>

	    <?php 
    if ($type !== 'lookbook') {
        ?>
<div class="row"><?php 
    }
    ?>
		
		<?php 
    if ($type == 'normal') {
        ?>
			<div class="large-12 columns"> 
			<ul class="large-block-grid-<?php 
        echo $columns;
        ?>
 small-block-grid-2">
        <?php 
    } else {
        if ($type == 'lookbook') {
            ?>
        	<div class="lookbook-slider">
			<ul class="ux-slider js-flickity slider-nav-small slider-nav-circle large-block-grid-<?php 
            echo $columns;
            ?>
 small-block-grid-2"
            	data-flickity-options='{ 
	                "cellAlign": "left", 
	                "wrapAround": <?php 
            echo $infinitive;
            ?>
,
	                "percentPosition": true,
	                "imagesLoaded": true,
	                "selectedAttraction" : 0.05,
         		    "friction": 0.6,
	                "pageDots": <?php 
            echo $bullets;
            ?>
,
	                "contain": true
	            }'>
       	<?php 
        } else {
            if ($type == 'masonry') {
                ?>
        	<div class="large-12 columns">
            <ul class="pinterest-style large-block-grid-<?php 
                echo $columns;
                ?>
 small-block-grid-2">
        <?php 
            } else {
                if ($type == 'slider') {
                    ?>
      	  <div class="large-12 columns">
            <ul class="ux-row-slider js-flickity slider-nav-small  slider-nav-reveal  slider-nav-push large-block-grid-<?php 
                    echo $columns;
                    ?>
 small-block-grid-2"
            	data-flickity-options='{ 
	                "cellAlign": "left", 
	                "wrapAround": <?php 
                    echo $infinitive;
                    ?>
,
	                "percentPosition": true,
	                "imagesLoaded": true,
	                "pageDots": <?php 
                    echo $bullets;
                    ?>
,
	                "selectedAttraction" : 0.05,
         		    "friction": 0.6,
	                "contain": true
	            }'>
        	<?php 
                }
            }
        }
    }
    $r = ux_list_products($atts);
    if ($r->have_posts()) {
        ?>
                        
                <?php 
        while ($r->have_posts()) {
            $r->the_post();
            ?>

                <?php 
            if ($type == 'lookbook') {
                woocommerce_get_template_part('content', 'product-lookbook');
            } else {
                if ($type == 'masonry') {
                    woocommerce_get_template_part('content', 'product-pinterest-style');
                } else {
                    woocommerce_get_template_part('content', 'product');
                }
            }
            ?>
                <?php 
        }
        // end of the loop.
        ?>
                
            <?php 
    }
    wp_reset_query();
    ?>
          </ul>   <!-- .products -->  
		</div>
	<?php 
    if ($type !== 'lookbook') {
        ?>
</div><!-- .row --><?php 
    }
    ?>

   	<?php 
    if ($type == 'masonry') {
        ?>
 
	 <script>
		/* PACKERY GRID */
		jQuery(document).ready(function ($) {
		    var $container = $(".pinterest-style");
		    // initialize
		    $container.packery({
		      itemSelector: "li",
		      gutter: 0
		    });

		    imagesLoaded( document.querySelector('.pinterest-style'), function( instance, container ) {
	  			$container.packery('layout');
			});
		 });
	</script>
    <?php 
    }
    ?>

	<?php 
    $content = ob_get_contents();
    ob_end_clean();
    return $content;
}
Пример #12
0
/**
 * Show a single product page
 **/
function woocommerce_product_page_shortcode($atts)
{
    if (empty($atts)) {
        return;
    }
    if (!$atts['id'] && !$atts['sku']) {
        return;
    }
    $args = array('posts_per_page' => 1, 'post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'no_found_rows' => 1);
    if (isset($atts['sku'])) {
        $args['meta_query'][] = array('key' => '_sku', 'value' => $atts['sku'], 'compare' => '=');
    }
    if (isset($atts['id'])) {
        $args['p'] = $atts['id'];
    }
    $single_product = new WP_Query($args);
    ob_start();
    while ($single_product->have_posts()) {
        $single_product->the_post();
        ?>

		<div class="single-product">
			
			<?php 
        woocommerce_get_template_part('content', 'single-product');
        ?>
			
		</div>

	<?php 
    }
    // end of the loop.
    wp_reset_query();
    return ob_get_clean();
}
Пример #13
0
    function wd_top_rated_product($atts, $content = null)
    {
        $_actived = apply_filters('active_plugins', get_option('active_plugins'));
        if (!in_array("woocommerce/woocommerce.php", $_actived)) {
            return;
        }
        global $woocommerce_loop, $woocommerce, $wd_data;
        extract(shortcode_atts(array('columns' => 4, 'per_page' => 4, 'cat_slug' => '', 'product_tag' => '', 'title' => '', 'desc' => '', 'show_type' => 'grid', 'show_image' => 1, 'show_title' => 1, 'show_sku' => 0, 'show_price' => 1, 'show_rating' => 1, 'show_label' => 1, 'show_categories' => 1, 'show_add_to_cart' => 1, 'show_short_content' => 0), $atts));
        if ($columns > 6) {
            $columns = 6;
        }
        if ($per_page < 1) {
            $per_page = 6;
        }
        if ($columns < 1) {
            $columns = 2;
        }
        if ($columns > 6) {
            $columns = 6;
        }
        $options = array('show_image' => $show_image, 'show_categories' => $show_categories, 'show_title' => $show_title, 'show_rating' => $show_rating, 'show_sku' => $show_sku, 'show_short_content' => $show_short_content, 'show_price' => $show_price, 'show_label' => $show_label, 'show_add_to_cart' => $show_add_to_cart);
        wd_remove_function_from_product_hook($options);
        $args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $per_page, 'orderby' => 'date', 'order' => 'desc', 'meta_query' => array(array('key' => '_visibility', 'value' => array('catalog', 'visible'), 'compare' => 'IN')));
        if (trim($cat_slug) != '') {
            $args['tax_query'] = array(array('taxonomy' => 'product_cat', 'terms' => array(esc_attr($cat_slug)), 'field' => 'slug', 'operator' => 'IN'));
        }
        if (strlen($product_tag) > 0 && strcmp('all-product-tags', $product_tag) != 0) {
            $args = array_merge($args, array('product_tag' => $product_tag));
        }
        ob_start();
        if (isset($wd_data['wd_prod_cat_column']) && absint($wd_data['wd_prod_cat_column']) > 0) {
            $_old_wd_prod_cat_column = $wd_data['wd_prod_cat_column'];
            $wd_data['wd_prod_cat_column'] = $columns;
        }
        $_old_woocommerce_loop_columns = $woocommerce_loop['columns'];
        add_filter('posts_clauses', 'wd_order_by_rating_post_clauses');
        $products = new WP_Query($args);
        remove_filter('posts_clauses', 'wd_order_by_rating_post_clauses');
        $woocommerce_loop['columns'] = $columns;
        $extra_class = '';
        if ($products->have_posts()) {
            ?>
				<div class="top-rated-product-sc shortcode-product <?php 
            echo $show_type;
            ?>
">
					<?php 
            if (strlen(trim($title)) > 0 || strlen(trim($desc)) > 0) {
                ?>
					<header class="shortcode-title-wrapper"> 
						<?php 
                if (strlen(trim($title)) > 0) {
                    echo "<h3 class='heading-title slider-title'>" . esc_html($title) . "</h3>";
                }
                ?>
					</header>
					<?php 
                if (strlen(trim($desc)) > 0) {
                    echo "<p class='slider-desc-wrapper'>" . esc_html($desc) . "</p>";
                }
                ?>
					<?php 
            }
            ?>
						
					<div class="<?php 
            echo $show_type;
            ?>
 product-wrapper ">	
						<div class="product-inner">
							
							<?php 
            $current_row = 0;
            ?>
							
							<?php 
            woocommerce_product_loop_start();
            ?>
								
								<?php 
            $woocommerce_loop['columns'] = $columns;
            ?>
								
								<?php 
            while ($products->have_posts()) {
                $products->the_post();
                ?>
																									
									<?php 
                woocommerce_get_template_part('content', 'product');
                ?>
									
									
								<?php 
            }
            // end of the loop.
            ?>
							<?php 
            woocommerce_product_loop_end();
            ?>
							
						</div>
					</div>	
					<div class="clear"></div>
				</div>
				
			<?php 
        }
        wp_reset_postdata();
        wd_restore_function_to_product_hook();
        $woocommerce_loop['columns'] = $_old_woocommerce_loop_columns;
        if (isset($_old_wd_prod_cat_column) && absint($_old_wd_prod_cat_column > 0)) {
            $wd_data['wd_prod_cat_column'] = $_old_wd_prod_cat_column;
        }
        return '<div class="woocommerce">' . ob_get_clean() . '</div>';
    }
Пример #14
0
    /**
     * List products with an attribute shortcode
     * Example [product_attribute attribute='color' filter='black']
     *
     * @access public
     * @param array $atts
     * @return string
     */
    function product_attribute($atts)
    {
        global $woocommerce_loop;
        extract(shortcode_atts(array('per_page' => '12', 'columns' => '4', 'orderby' => 'title', 'order' => 'asc', 'attribute' => '', 'filter' => ''), $atts));
        $attribute = strstr($attribute, 'pa_') ? sanitize_title($attribute) : 'pa_' . sanitize_title($attribute);
        $filter = sanitize_title($filter);
        $args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $per_page, 'orderby' => $orderby, 'order' => $order, 'meta_query' => array(array('key' => '_visibility', 'value' => array('catalog', 'visible'), 'compare' => 'IN')), 'tax_query' => array(array('taxonomy' => $attribute, 'terms' => $filter, 'field' => 'slug')));
        ob_start();
        $products = new WP_Query($args);
        $woocommerce_loop['columns'] = $columns;
        if ($products->have_posts()) {
            ?>

			<?php 
            woocommerce_product_loop_start();
            ?>

				<?php 
            while ($products->have_posts()) {
                $products->the_post();
                ?>

					<?php 
                woocommerce_get_template_part('content', 'product');
                ?>

				<?php 
            }
            // end of the loop.
            ?>

			<?php 
            woocommerce_product_loop_end();
            ?>

		<?php 
        }
        wp_reset_postdata();
        return '<div class="woocommerce">' . ob_get_clean() . '</div>';
    }
Пример #15
0
/**
 * Recent Products shortcode
 **/
function etheme_woocommerce_recent_products($atts)
{
    global $woocommerce_loop;
    extract(shortcode_atts(array('limit' => '12', 'columns' => '4', 'orderby' => 'date', 'order' => 'desc'), $atts));
    $args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $limit, 'orderby' => $orderby, 'order' => $order, 'meta_query' => array(array('key' => '_visibility', 'value' => array('catalog', 'visible'), 'compare' => 'IN')));
    ob_start();
    $products = new WP_Query($args);
    if ($products->have_posts()) {
        ?>
            
        <div id="products-grid" style="padding: 0;" class="products_grid shortcode-products row rows-count<?php 
        echo $columns;
        ?>
">
    		<?php 
        while ($products->have_posts()) {
            $products->the_post();
            ?>
    	
    			<?php 
            woocommerce_get_template_part('content', 'product');
            ?>
    
    		<?php 
        }
        // end of the loop.
        ?>
		</div>
		<div class="clear"></div>
        <script type="text/javascript">imageTooltip(jQuery('.imageTooltip'))</script>
				
	<?php 
    }
    wp_reset_query();
    return ob_get_clean();
}
Пример #16
0
function ux_custom_products($atts, $content = null)
{
    $sliderrandomid = rand();
    extract(shortcode_atts(array("title" => '', 'products' => '8', 'cat' => '', 'orderby' => 'date', 'order' => 'desc', 'columns' => '4', 'infinitive' => 'false'), $atts));
    ob_start();
    ?>
    
    <?php 
    /**
     * Check if WooCommerce is active
     **/
    if (function_exists('wc_print_notices')) {
        ?>
    
		<?php 
        if ($title) {
            ?>
 
		<div class="row">
			<div class="large-12 columns">
				<h3 class="section-title"><span><?php 
            echo $title;
            ?>
</span></h3>
			</div>
		</div><!-- end .title -->
		<?php 
        }
        ?>

		<div class="row column-slider">
            <div id="slider_<?php 
        echo $sliderrandomid;
        ?>
" class="iosSlider" style="overflow:hidden;height:200px;min-height:200px;">
                <ul class="slider large-block-grid-<?php 
        echo $columns;
        ?>
 small-block-grid-2">
				  <?php 
        $args = array('product_cat' => $cat, 'post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $products, 'orderby' => $orderby, 'order' => $order);
        $products = new WP_Query($args);
        if ($products->have_posts()) {
            ?>
                                
                        <?php 
            while ($products->have_posts()) {
                $products->the_post();
                ?>
                    
                            <?php 
                woocommerce_get_template_part('content', 'product');
                ?>
                
                        <?php 
            }
            // end of the loop.
            ?>
                        
                    <?php 
        }
        wp_reset_query();
        ?>
                </ul>   <!-- .slider -->  
                  <div class="sliderControlls">
				        <div class="sliderNav small hide-for-small">
				       		 <a href="javascript:void(0)" class="nextSlide disabled prev_<?php 
        echo $sliderrandomid;
        ?>
"><span class="icon-angle-left"></span></a>
				       		 <a href="javascript:void(0)" class="prevSlide next_<?php 
        echo $sliderrandomid;
        ?>
"><span class="icon-angle-right"></span></a>
				        </div>
       			   </div><!-- .sliderControlls -->
       		 </div> <!-- .iOsslider -->
    </div><!-- .row .column-slider -->

    
    <?php 
    }
    ?>

    <?php 
    slider_script($sliderrandomid, $columns, $infinitive);
    ?>


	<?php 
    $content = ob_get_contents();
    ob_end_clean();
    return $content;
}
Пример #17
0
<?php

/**
 * Cross-sells
 */
global $woocommerce_loop, $woocommerce, $product;
$crosssells = $woocommerce->cart->get_cross_sells();
if (sizeof($crosssells) == 0) {
    return;
}
$woocommerce_loop['columns'] = 2;
$woocommerce_loop['wip_cols'] = 4;
?>
<div class="cross-sells">
	<h2><?php 
_e('You may be interested in&hellip;', 'wip');
?>
</h2>
	<?php 
$args = array('post_type' => 'product', 'ignore_sticky_posts' => 1, 'posts_per_page' => 2, 'orderby' => 'rand', 'post__in' => $crosssells);
query_posts($args);
woocommerce_get_template_part('loop', 'shop');
wp_reset_query();
?>
</div>
Пример #18
0
        function fruitful_woocommerce_cross_sell_display()
        {
            if (!defined('ABSPATH')) {
                exit;
            }
            // Exit if accessed directly
            global $woocommerce_loop, $woocommerce, $product;
            $crosssells = $woocommerce->cart->get_cross_sells();
            if (sizeof($crosssells) == 0) {
                return;
            }
            $meta_query = $woocommerce->query->get_meta_query();
            $args = array('post_type' => 'product', 'ignore_sticky_posts' => 1, 'posts_per_page' => apply_filters('woocommerce_cross_sells_total', 4), 'no_found_rows' => 1, 'orderby' => 'rand', 'post__in' => $crosssells, 'meta_query' => $meta_query);
            $products = new WP_Query($args);
            $woocommerce_loop['columns'] = apply_filters('woocommerce_cross_sells_columns', 4);
            if ($products->have_posts()) {
                ?>
				<div class="cross-sells">
					<h2><?php 
                _e('You may be interested in&hellip;', 'woocommerce');
                ?>
</h2>
					<?php 
                woocommerce_product_loop_start();
                ?>
						<?php 
                while ($products->have_posts()) {
                    $products->the_post();
                    ?>
							<?php 
                    woocommerce_get_template_part('content', 'product');
                    ?>
						<?php 
                }
                // end of the loop.
                ?>
					<?php 
                woocommerce_product_loop_end();
                ?>
				</div>
			<?php 
            }
            wp_reset_query();
        }
Пример #19
0
function woo($atts, $content = null)
{
    esc_attr(extract(shortcode_atts(array('hot' => 'yes', 'best' => 'yes', 'new' => 'new', 'ajax' => 'yes', 'per' => '12', 'cols' => '4', 'a' => ''), $atts)));
    global $woocommerce_loop;
    if ($ajax == 'yes') {
        ob_start();
        ?>
<script type="text/javascript">
//LOADER
jQuery(document).ready(function(){
var ajaxurl = '<?php 
        echo admin_url('admin-ajax.php');
        ?>
';
jQuery('.load_button').live('click', function(){ 
  var $button = jQuery(this);
  var cur_page = $button.attr('data-cur-page');
  var next_page = parseInt(cur_page)+1;
  var max_pages = parseInt($button.attr('data-max-pages'));
  var id = $button.attr('id');
    
	jQuery.post( ajaxurl, { action: 'cbprodloader',typ:id,next_page:next_page,per:<?php 
        echo $per;
        ?>
,cols:<?php 
        echo $cols;
        ?>
,security:'<?php 
        echo wp_create_nonce('cosmetico-settings');
        ?>
'}, function(data){

  jQuery('#ul_'+id).append(data);
    
  $button.attr('data-cur-page',next_page.toString());
  
  jQuery('html, body').animate({
         scrollTop: jQuery('#bcon_'+id).offset().top- jQuery('#ul_'+id+' li').outerHeight()
     }, 500);
	 
	 if(max_pages==next_page) { 
  $button.fadeOut(); 
  jQuery('#bcon_'+id).addClass('no_more');
  }
  });
});

});
//LOADER END
</script>
<?php 
        $woo = ob_get_clean();
        ob_flush();
    }
    $args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $per, 'meta_query' => array(array('key' => '_visibility', 'value' => array('catalog', 'visible'), 'compare' => 'IN'), array('key' => '_sale_price', 'value' => 0, 'compare' => '>', 'type' => 'NUMERIC')));
    ob_start();
    $products = new WP_Query($args);
    //echo '<pre>';print_r($products);echo '</pre>';
    $woocommerce_loop['columns'] = $cols;
    if ($products->have_posts()) {
        ?>
         <ul class="products" id="ul_hot_products">
             <?php 
        while ($products->have_posts()) {
            $products->the_post();
            ?>
                 <?php 
            woocommerce_get_template_part('content', 'product');
            ?>
             <?php 
        }
        ?>
         </ul>
		 
		 <?php 
        if ($products->found_posts > $per && $ajax == 'yes') {
            echo '<div class="woo_load_container" id="bcon_hot_products"><button class="load_button load_more_products" id="hot_products" data-max-pages="' . $products->max_num_pages . '" data-cur-page="1">' . __('Load more hot products', 'cb-cosmetico') . '</button></div>';
        }
        ?>
     <?php 
    }
    wp_reset_query();
    $woo_sale = ob_get_clean();
    ob_flush();
    $args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $per, 'orderby' => 'date', 'order' => 'desc', 'meta_query' => array(array('key' => '_visibility', 'value' => array('catalog', 'visible'), 'compare' => 'IN')));
    ob_start();
    $products = new WP_Query($args);
    //echo '<pre>';print_r($products);echo '</pre>';
    $woocommerce_loop['columns'] = $cols;
    if ($products->have_posts()) {
        ?>
         <ul class="products" id="ul_new_products">
             <?php 
        while ($products->have_posts()) {
            $products->the_post();
            ?>
                 <?php 
            woocommerce_get_template_part('content', 'product');
            ?>
             <?php 
        }
        ?>
         </ul>
	
		<?php 
        if ($products->found_posts > $per && $ajax == 'yes') {
            echo '	 <div class="woo_load_container" id="bcon_new_products"><button class="load_button load_more_products" id="new_products" data-max-pages="' . $products->max_num_pages . '" data-cur-page="1">' . __('Load more new products', 'cb-cosmetico') . '</button></div>';
        }
        ?>
     <?php 
    }
    wp_reset_query();
    $woo_new = ob_get_clean();
    ob_flush();
    $args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $per, 'meta_key' => 'total_sales', 'orderby' => 'meta_value', 'meta_query' => array(array('key' => '_visibility', 'value' => array('catalog', 'visible'), 'compare' => 'IN')));
    ob_start();
    $products = new WP_Query($args);
    //echo '<pre>';print_r($products);echo '</pre>';
    $woocommerce_loop['columns'] = $cols;
    if ($products->have_posts()) {
        ?>
         <ul class="products" id="ul_best_sellers">
             <?php 
        while ($products->have_posts()) {
            $products->the_post();
            ?>
                 <?php 
            woocommerce_get_template_part('content', 'product');
            ?>
             <?php 
        }
        ?>
         </ul>
		 	 
		 <?php 
        if ($products->found_posts > $per && $ajax == 'yes') {
            echo '<div class="woo_load_container" id="bcon_best_sellers"><button class="load_button load_more_products" id="best_sellers" data-max-pages="' . $products->max_num_pages . '" data-cur-page="1">' . __('Load more best sellers', 'cb-cosmetico') . '</button></div>';
        }
        ?>
     <?php 
    }
    wp_reset_query();
    $woo_best = ob_get_clean();
    ob_flush();
    $iar = '';
    if ($a == 'left') {
        $iar = 'nocenter';
    }
    $woo_best_f = '';
    $woo_best_f2 = '';
    $woo_new_f = '';
    $woo_new_f2 = '';
    $woo_hot_f = '';
    $woo_hot_f2 = '';
    if ($new == 'yes') {
        $woo_new_f = '<li><a href="#tabs-2"><span>' . __('New Products', 'cb-cosmetico') . '</span></a></li>';
        $woo_new_f2 = '<div id="tabs-2" class="tabcontent">' . $woo_new . '<div class="cl"></div></div>';
    }
    if ($best == 'yes') {
        $woo_best_f = '<li><a href="#tabs-3"><span>' . __('Best Sellers', 'cb-cosmetico') . '</span></a></li>';
        $woo_best_f2 = '<div id="tabs-3" class="tabcontent">' . $woo_best . '<div class="cl"></div></div>';
    }
    if ($hot == 'yes') {
        $woo_hot_f = '<li><a href="#tabs-1"><span>' . __('Hot Products', 'cb-cosmetico') . '</span></a></li>';
        $woo_hot_f2 = '<div id="tabs-1" class="tabcontent">' . $woo_sale . '<div class="cl"></div></div>';
    }
    $woo .= '<div class="tabs round cb5_woo cb5_block ' . $iar . '"><ul>' . $woo_hot_f . $woo_new_f . $woo_best_f . '</ul>' . $woo_hot_f2 . $woo_new_f2 . $woo_best_f2 . '</div><div class="cl"></div>';
    return apply_filters('woo', $woo);
}
Пример #20
0
function ux_product_flip($atts, $content = null)
{
    /* register script */
    wp_register_script('flatsome-flip', get_template_directory_uri() . '/js/jquery.mobile.flip.js', array('jquery'), '20120202', true);
    wp_enqueue_script('flatsome-flip');
    global $woocommerce;
    $sliderrandomid = rand();
    extract(shortcode_atts(array('products' => '8', 'height' => '600', 'cat' => ''), $atts));
    ob_start();
    $args = array('post_type' => 'product', 'post_status' => 'publish', 'product_cat' => $cat, 'products' => $products);
    ?>
<div class="container">
  <div class="row">
    <div class="large-12 columns">
      <div id="flipRoot" class="flipContainer">
            <?php 
    if ($content) {
        ?>
            <div class="row-collapse flip-slide">
              <div class="large-12 columns">
                 <?php 
        echo do_shortcode($content);
        ?>
              </div><!-- large-6 -->
             </div><!-- row -->
             <?php 
    }
    ?>

               <?php 
    $products = new WP_Query($args);
    if ($products->have_posts()) {
        ?>
                      <?php 
        while ($products->have_posts()) {
            $products->the_post();
            ?>
                       <div class="row-collapse">
                          <?php 
            woocommerce_get_template_part('content', 'product-flipbook');
            ?>
                        </div>
                      <?php 
        }
        // end of the loop.
        ?>
                  <?php 
    }
    wp_reset_query();
    ?>
      </div>
    </div>
  </div>
</div>
	<script type="text/javascript">

	jQuery(document).ready(function($) {
			 $("#flipRoot").flip({
        height: '<?php 
    echo $height . "px";
    ?>
',
        showPager: true,
        loop: false
      });
	});

	</script>
	<?php 
    $content = ob_get_contents();
    ob_end_clean();
    return $content;
}
Пример #21
0
    function sf_product_items($atts)
    {
        extract(shortcode_atts(array('title' => '', 'asset_type' => '', 'category' => '', 'products' => '', 'display_layout' => '', 'display_type' => '', 'carousel' => '', 'multi_masonry' => '', 'fullwidth' => '', 'gutters' => '', 'columns' => '', 'item_count' => '', 'order_by' => '', 'order' => '', 'button_enabled' => '', 'width' => ''), $atts));
        global $woocommerce, $woocommerce_loop, $sf_sidebar_config, $sf_carouselID, $sf_options, $sf_product_multimasonry, $sf_product_display_layout;
        if ($sf_carouselID == "") {
            $sf_carouselID = 1;
        } else {
            $sf_carouselID++;
        }
        if (is_singular('portfolio')) {
            $sf_sidebar_config = "no-sidebars";
        }
        $list_class = "";
        $product_display_type = $sf_options['product_display_type'];
        if ($display_type != "") {
            $product_display_type = $display_type;
        }
        if ($fullwidth == "yes") {
            $list_class .= 'products-full-width ';
        }
        if ($gutters == "no" || $product_display_type == "gallery-bordered") {
            $list_class .= 'no-gutters ';
        }
        if ($multi_masonry == "yes" && $product_display_type != "preview-slider" && $asset_type != "categories") {
            $carousel = "no";
            $list_class .= 'multi-masonry-items ';
            $sf_product_multimasonry = true;
        } else {
            $sf_product_multimasonry = false;
        }
        if ($display_layout != '') {
            $sf_product_display_layout = $display_layout;
        }
        if ($carousel == "no" && $multi_masonry == "no") {
            $list_class .= 'product-grid ';
        }
        $list_class .= 'product-type-' . $product_display_type . ' ';
        $woocommerce_loop['style-override'] = $product_display_type;
        $args = array();
        $sf_prev_icon = apply_filters('sf_carousel_prev_icon', '<i class="ss-navigateleft"></i>');
        $sf_next_icon = apply_filters('sf_carousel_next_icon', '<i class="ss-navigateright"></i>');
        // CATEGORY ASSET OUTPUT
        if ($asset_type == "categories") {
            ob_start();
            $hide_empty = 1;
            $category_id = '';
            $ids = array();
            if ($category != "") {
                $category = str_replace("0,", "", $category);
                $categories = explode(',', $category);
                foreach ($categories as $term) {
                    $category_term = get_term_by('slug', $term, 'product_cat');
                    $category_id = $category_term->term_id;
                    array_push($ids, $category_id);
                }
            }
            $args = array('hide_empty' => $hide_empty, 'pad_counts' => true, 'include' => $ids);
            $product_categories = get_terms('product_cat', $args);
            if ($hide_empty) {
                foreach ($product_categories as $key => $category) {
                    if ($category->count == 0) {
                        unset($product_categories[$key]);
                    }
                }
            }
            if ($item_count) {
                $product_categories = array_slice($product_categories, 0, $item_count);
            }
            ob_start();
            if ($product_categories) {
                if ($carousel == "yes") {
                    ?>

	                    <div class="product-carousel carousel-wrap <?php 
                    echo $list_class;
                    ?>
">

	                        <ul class="products list-<?php 
                    echo $asset_type;
                    ?>
 carousel-items gutters" id="carousel-<?php 
                    echo $sf_carouselID;
                    ?>
" data-columns="<?php 
                    echo $columns;
                    ?>
">

	                            <?php 
                    foreach ($product_categories as $category) {
                        wc_get_template('content-product_cat.php', array('category' => $category));
                    }
                    ?>

	                        </ul>

	                        <?php 
                    if (sf_theme_opts_name() != "sf_atelier_options") {
                        ?>

	                        <a href="#" class="carousel-prev"><?php 
                        echo $sf_prev_icon;
                        ?>
</a>
	                        <a href="#" class="carousel-next"><?php 
                        echo $sf_next_icon;
                        ?>
</a>

							<?php 
                    }
                    ?>

	                    </div>

	                <?php 
                } else {
                    ?>

	                    <ul class="products list-<?php 
                    echo $asset_type;
                    ?>
 row <?php 
                    echo $list_class;
                    ?>
">

	                        <?php 
                    foreach ($product_categories as $category) {
                        wc_get_template('content-product_cat.php', array('category' => $category));
                    }
                    ?>

	                    </ul>

	                <?php 
                }
            }
            woocommerce_reset_loop();
            $product_list_output = ob_get_contents();
            ob_end_clean();
            wp_reset_query();
            wp_reset_postdata();
            return $product_list_output;
        }
        // ARRAY ARGUMENTS
        if ($asset_type == "latest-products") {
            $args = array('post_type' => 'product', 'post_status' => 'publish', 'product_cat' => $category, 'ignore_sticky_posts' => 1, 'posts_per_page' => $item_count, 'orderby' => $order_by, 'order' => $order);
            $args['meta_query'] = array();
            $args['meta_query'][] = $woocommerce->query->stock_status_meta_query();
            $args['meta_query'][] = $woocommerce->query->visibility_meta_query();
        } else {
            if ($asset_type == "featured-products") {
                $args = array('post_type' => 'product', 'post_status' => 'publish', 'product_cat' => $category, 'ignore_sticky_posts' => 1, 'meta_key' => '_featured', 'meta_value' => 'yes', 'posts_per_page' => $item_count, 'orderby' => $order_by, 'order' => $order);
            } else {
                if ($asset_type == "top-rated") {
                    add_filter('posts_clauses', array($woocommerce->query, 'order_by_rating_post_clauses'));
                    $args = array('post_type' => 'product', 'post_status' => 'publish', 'product_cat' => $category, 'ignore_sticky_posts' => 1, 'posts_per_page' => $item_count, 'orderby' => $order_by, 'order' => $order);
                    $args['meta_query'] = $woocommerce->query->get_meta_query();
                } else {
                    if ($asset_type == "recently-viewed") {
                        // Get recently viewed product cookies data
                        $viewed_products = !empty($_COOKIE['woocommerce_recently_viewed']) ? (array) explode('|', $_COOKIE['woocommerce_recently_viewed']) : array();
                        $viewed_products = array_filter(array_map('absint', $viewed_products));
                        // If no data, quit
                        if (empty($viewed_products)) {
                            return '<p class="no-products">' . __("You haven't viewed any products yet.", "swiftframework") . '</p>';
                        }
                        // Create query arguments array
                        $args = array('post_type' => 'product', 'post_status' => 'publish', 'product_cat' => $category, 'ignore_sticky_posts' => 1, 'posts_per_page' => $item_count, 'no_found_rows' => 1, 'post__in' => $viewed_products, 'orderby' => $order_by, 'order' => $order);
                        // Add meta_query to query args
                        //$args['meta_query'] = array();
                        // Check products stock status
                        //$args['meta_query'][] = $woocommerce->query->stock_status_meta_query();
                    } else {
                        if ($asset_type == "sale-products") {
                            // Get products on sale
                            $product_ids_on_sale = wc_get_product_ids_on_sale();
                            $meta_query = array();
                            $meta_query[] = WC()->query->visibility_meta_query();
                            $meta_query[] = WC()->query->stock_status_meta_query();
                            $meta_query = array_filter($meta_query);
                            $args = array('product_cat' => $category, 'posts_per_page' => $item_count, 'no_found_rows' => 1, 'post_status' => 'publish', 'post_type' => 'product', 'meta_query' => $meta_query, 'orderby' => $order_by, 'order' => $order, 'post__in' => array_merge(array(0), $product_ids_on_sale));
                        } else {
                            if ($asset_type == "selected-products") {
                                $meta_query = array();
                                $meta_query[] = WC()->query->visibility_meta_query();
                                $meta_query[] = WC()->query->stock_status_meta_query();
                                $meta_query = array_filter($meta_query);
                                $product_ids = explode(',', $products);
                                $args = array('posts_per_page' => -1, 'no_found_rows' => 1, 'post_status' => 'publish', 'post_type' => 'product', 'meta_query' => $meta_query, 'orderby' => $order_by, 'order' => $order, 'post__in' => array_merge(array(0), $product_ids));
                            } else {
                                $args = array('post_type' => 'product', 'post_status' => 'publish', 'product_cat' => $category, 'ignore_sticky_posts' => 1, 'posts_per_page' => $item_count, 'meta_key' => 'total_sales', 'orderby' => 'meta_value_num', 'meta_query' => array(array('key' => '_visibility', 'value' => array('catalog', 'visible'), 'compare' => 'IN')));
                                $args['meta_query'] = array();
                                $args['meta_query'][] = $woocommerce->query->stock_status_meta_query();
                                $args['meta_query'][] = $woocommerce->query->visibility_meta_query();
                            }
                        }
                    }
                }
            }
        }
        ob_start();
        // OUTPUT PRODUCTS
        $products = new WP_Query($args);
        // Set Columns
        $woocommerce_loop['columns'] = apply_filters('loop_shop_columns', intval($columns));
        if ($products->have_posts()) {
            ?>

                <?php 
            if ($carousel == "yes") {
                ?>

                    <div class="product-carousel carousel-wrap <?php 
                echo $list_class;
                ?>
">

                        <ul class="products list-<?php 
                echo $asset_type;
                ?>
 carousel-items gutters" id="carousel-<?php 
                echo $sf_carouselID;
                ?>
" data-columns="<?php 
                echo $columns;
                ?>
">

                            <?php 
                while ($products->have_posts()) {
                    $products->the_post();
                    ?>

                                <?php 
                    woocommerce_get_template_part('content', 'product');
                    ?>

                            <?php 
                }
                // end of the loop.
                ?>

                        </ul>

                        <?php 
                if (sf_theme_opts_name() != "sf_atelier_options" && sf_theme_opts_name() != "sf_uplift_options") {
                    ?>

                        <a href="#" class="carousel-prev"><?php 
                    echo $sf_prev_icon;
                    ?>
</a>
                        <a href="#" class="carousel-next"><?php 
                    echo $sf_next_icon;
                    ?>
</a>

						<?php 
                }
                ?>

                    </div>

                <?php 
            } else {
                ?>

                    <ul class="products list-<?php 
                echo $asset_type;
                ?>
 row <?php 
                echo $list_class;
                ?>
" data-columns="<?php 
                echo $columns;
                ?>
">

                    	<?php 
                if ($multi_masonry == "yes") {
                    ?>

                    		<div class="clearfix product col-sm-3 grid-sizer"></div>

                    	<?php 
                }
                ?>

                        <?php 
                while ($products->have_posts()) {
                    $products->the_post();
                    ?>

                            <?php 
                    woocommerce_get_template_part('content', 'product');
                    ?>

                        <?php 
                }
                // end of the loop.
                ?>

                    </ul>

                <?php 
            }
            ?>

            <?php 
        }
        // Get contents and then clean output
        $product_list_output = ob_get_contents();
        ob_end_clean();
        // Reset query
        wp_reset_query();
        wp_reset_postdata();
        remove_filter('posts_clauses', array($woocommerce->query, 'order_by_rating_post_clauses'));
        // Reset global
        $sf_product_display_layout = "";
        return $product_list_output;
    }
Пример #22
0
	'orderby' 				=> $orderby,
	'post__in' 				=> $related
) );

$products = new WP_Query( $args );

$woocommerce_loop['columns'] 	= $columns;

if ( $products->have_posts() ) : ?>
	
	<hr>
	<div class="related products">

		<h5><?php _e('RELATED PRODUCTS', 'woocommerce'); ?></h5>

		<div class="products">

			<?php while ( $products->have_posts() ) : $products->the_post(); ?>

				<?php woocommerce_get_template_part( 'content', 'product-small' ); ?>

			<?php endwhile; // end of the loop. ?>

		</div>

	</div>

<?php endif;

wp_reset_postdata();
Пример #23
0
function product_lookbook($atts, $content = null)
{
    $sliderrandomid = rand();
    extract(shortcode_atts(array('products' => '8', 'cat' => ''), $atts));
    ob_start();
    ?>
    
    <?php 
    /**
     * Check if WooCommerce is active
     **/
    if (in_array('woocommerce/woocommerce.php', apply_filters('active_plugins', get_option('active_plugins')))) {
        ?>
	 <script>
	jQuery(document).ready(function($) {
		$('#slider_<?php 
        echo $sliderrandomid;
        ?>
').iosSlider({
			snapToChildren: true,
			desktopClickDrag: true,
			infiniteSlider: true,
			navPrevSelector: '.prev_<?php 
        echo $sliderrandomid;
        ?>
',
			navNextSelector: '.next_<?php 
        echo $sliderrandomid;
        ?>
',
			onSliderLoaded: slideLoad,
			onSliderResize: slideLoad,
		});

		function slideLoad(args) {
			 imagesLoaded( '#slider_<?php 
        echo $sliderrandomid;
        ?>
', function() {
			  	 var slider_height = $(args.sliderContainerObject).find('img:first').height();
		         $(args.sliderContainerObject).css('min-height',slider_height);	
			 }); // images loaded 
    	 }
	    
	});
	</script> 
	
            <div id="slider_<?php 
        echo $sliderrandomid;
        ?>
" class="iosSlider lookbook-slider" style="height:300px;overflow:hidden;">
                <ul class="slider large-block-grid-3 small-block-grid-1">
				  <?php 
        $args = array('post_type' => 'product', 'post_status' => 'publish', 'product_cat' => $cat, 'posts_per_page' => $products);
        $products = new WP_Query($args);
        if ($products->have_posts()) {
            ?>
                                
                        <?php 
            while ($products->have_posts()) {
                $products->the_post();
                ?>
                    
                            <?php 
                woocommerce_get_template_part('content', 'product-lookbook');
                ?>
                
                        <?php 
            }
            // end of the loop.
            ?>
                        
                    <?php 
        }
        wp_reset_query();
        ?>
                </ul>   <!-- .slider -->  
                 
                <div class="sliderControlls dark">
			        <div class="sliderNav hide-for-small">
			        <a href="javascript:void(0)" class="nextSlide prev_<?php 
        echo $sliderrandomid;
        ?>
"><span class="icon-angle-left"></span></a>
			        <a href="javascript:void(0)" class="prevSlide next_<?php 
        echo $sliderrandomid;
        ?>
"><span class="icon-angle-right"></span></a>
			        </div>
       		    </div><!-- .sliderControlls -->
       		 </div> <!-- .iOsslider -->

    <?php 
    }
    ?>

	<?php 
    $content = ob_get_contents();
    ob_end_clean();
    return $content;
}
    /**
     * Output shortcode
     *
     * @access public
     * @param array $atts
     * @return void
     * 
     */
    public static function output($atts)
    {
        global $woocommerce, $wpdb;
        extract(shortcode_atts(array('show_buy_it_now' => 'false'), $atts));
        if (!is_user_logged_in()) {
            return;
        }
        $user_id = get_current_user_id();
        $postids = array();
        $userauction = $wpdb->get_results("SELECT DISTINCT auction_id FROM " . $wpdb->prefix . "simple_auction_log WHERE userid = {$user_id} ", ARRAY_N);
        if (isset($userauction) && !empty($userauction)) {
            foreach ($userauction as $auction) {
                $postids[] = $auction[0];
            }
        }
        ?>
			<div class="simple-auctions active-auctions clearfix">
				<h2><?php 
        _e('Active auctions', 'wc_simple_auctions');
        ?>
</h2>
				
				<?php 
        $args = array('post__in' => $postids, 'post_type' => 'product', 'posts_per_page' => '-1', 'order' => 'ASC', 'orderby' => 'meta_value', 'tax_query' => array(array('taxonomy' => 'product_type', 'field' => 'slug', 'terms' => 'auction')), 'meta_query' => array(array('key' => '_auction_closed', 'compare' => 'NOT EXISTS')), 'auction_arhive' => TRUE, 'show_past_auctions' => FALSE);
        //var_dump($args);
        $activeloop = new WP_Query($args);
        //var_dump($activeloop);
        if ($activeloop->have_posts() && !empty($postids)) {
            woocommerce_product_loop_start();
            while ($activeloop->have_posts()) {
                $activeloop->the_post();
                woocommerce_get_template_part('content', 'product');
            }
            woocommerce_product_loop_end();
        } else {
            _e("You are not participating in auction.", "wc_simple_auctions");
        }
        wp_reset_postdata();
        ?>
			
			</div>
			<div class="simple-auctions active-auctions clearfix">
				<h2><?php 
        _e('Won auctions', 'wc_simple_auctions');
        ?>
</h2>
				
				<?php 
        $auction_closed_type[] = '2';
        if ($show_buy_it_now == 'true') {
            $auction_closed_type[] = '3';
        }
        $args = array('post_type' => 'product', 'posts_per_page' => '-1', 'order' => 'ASC', 'orderby' => 'meta_value', 'meta_key' => '_auction_dates_to', 'meta_query' => array(array('key' => '_auction_closed', 'value' => $auction_closed_type, 'compare' => 'IN'), array('key' => '_auction_current_bider', 'value' => $user_id)), 'show_past_auctions' => TRUE, 'auction_arhive' => TRUE);
        $winningloop = new WP_Query($args);
        if ($winningloop->have_posts() && !empty($postids)) {
            woocommerce_product_loop_start();
            while ($winningloop->have_posts()) {
                $winningloop->the_post();
                woocommerce_get_template_part('content', 'product');
            }
            woocommerce_product_loop_end();
        } else {
            _e("You did not win any auctions yet.", "wc_simple_auctions");
        }
        wp_reset_postdata();
        echo "</div>";
    }
Пример #25
0
function avada_woo_product($atts, $content = null)
{
    global $woocommerce_loop;
    if (empty($atts)) {
        return;
    }
    $args = array('post_type' => 'product', 'posts_per_page' => 1, 'no_found_rows' => 1, 'post_status' => 'publish', 'meta_query' => array(array('key' => '_visibility', 'value' => array('catalog', 'visible'), 'compare' => 'IN')), 'columns' => 1);
    if (isset($atts['sku'])) {
        $args['meta_query'][] = array('key' => '_sku', 'value' => $atts['sku'], 'compare' => '=');
    }
    if (isset($atts['id'])) {
        $args['p'] = $atts['id'];
    }
    ob_start();
    if (isset($columns)) {
        $woocommerce_loop['columns'] = $columns;
    }
    $products = new WP_Query($args);
    if ($products->have_posts()) {
        ?>

		<?php 
        woocommerce_product_loop_start();
        ?>

			<?php 
        while ($products->have_posts()) {
            $products->the_post();
            ?>

				<?php 
            woocommerce_get_template_part('content', 'product');
            ?>

			<?php 
        }
        // end of the loop.
        ?>

		<?php 
        woocommerce_product_loop_end();
        ?>

	<?php 
    }
    wp_reset_postdata();
    return '<div class="woocommerce">' . ob_get_clean() . '</div>';
}
Пример #26
0
function blox_parse_carousel_hook($atts, $content = null)
{
    extract(shortcode_atts(array('title' => '', 'post_type' => 'post', 'category' => '0', 'count' => '6', 'item_style' => 'default', 'overlay' => 'none', 'slideseconds' => 0, 'animation' => '', 'extra_class' => '', 'skin' => '', 'visibility' => ''), $atts));
    $visibility = str_replace(',', ' ', $visibility);
    $extra_class = $extra_class . ' ' . $visibility;
    global $post, $product, $woocommerce, $woocommerce_loop;
    global $the_query;
    $temp_post = $post;
    $temp_query = $the_query;
    $args = array('post_type' => $post_type, 'posts_per_page' => (int) $count, 'ignore_sticky_posts' => 1);
    if ($category != '' && $category != '0') {
        $taxonomies = get_object_taxonomies($post_type);
        $args['tax_query'] = array(array('taxonomy' => $taxonomies[0], 'terms' => $category));
    }
    $i = 0;
    $html = '';
    $title = $title != '' ? '<h3 class="element-title">' . $title . '</h3>' : '';
    $the_query = new WP_Query($args);
    while ($the_query->have_posts()) {
        $the_query->the_post();
        if ($post_type == 'product') {
            $product = get_product(get_the_Id());
            ob_start();
            woocommerce_get_template_part('content', 'product');
            $html .= ob_get_clean();
        } else {
            $thumb = wp_get_attachment_url(get_post_thumbnail_id($post->ID));
            $image = $thumb != '' ? blox_aq_resize($thumb, 400, 300, true) : '';
            $i++;
            $folio_arg = array('item_style' => $item_style, 'overlay' => $overlay, 'thumb' => $image, 'class' => 'col-md-3 col-sm-6 col-xs-12 swiper-slide', 'width' => '400', 'height' => '300');
            $html .= blox_loop_portfolio($folio_arg);
        }
    }
    $the_query = $temp_query;
    $post = $temp_post;
    $autoplay = 'data-duration="' . (int) $slideseconds * 1000 . '"';
    if ($post_type == 'product') {
        return "<div class='blox-element blox-carousel woocommerce swiper-container' {$autoplay}>\n                    {$title}\n                    <ul class='blox-element products swiper-wrapper'>\n                        " . $html . "\n                    </ul>\n                    <div class='carousel-control-prev'><i class='fa-angle-left'></i></div>\n                    <div class='carousel-control-next'><i class='fa-angle-right'></i></div>\n                </div>";
    }
    $skin = $item_style != 'alternative' ? $skin : '';
    return "<div class='blox-element blox-carousel swiper-container {$extra_class}' {$autoplay}>\n                {$title}\n                <div class='blox-element grid-loop portfolio swiper-wrapper {$skin}'>\n                    " . $html . "\n                </div>\n                <div class='carousel-control-prev'><i class='fa-angle-left'></i></div>\n                <div class='carousel-control-next'><i class='fa-angle-right'></i></div>\n            </div>";
}
    function woocommerce_content()
    {
        if (is_singular('product')) {
            while (have_posts()) {
                the_post();
                woocommerce_get_template_part('content', 'single-product');
            }
        } else {
            ?>
<h1 class="page-title">
				<?php 
            if (is_search()) {
                ?>
					<?php 
                printf(__('Search Results: &ldquo;%s&rdquo;', 'woocommerce'), get_search_query());
                ?>
				<?php 
            } elseif (is_tax()) {
                ?>
					<?php 
                echo single_term_title("", false);
                ?>
				<?php 
            } else {
                ?>
					<?php 
                $shop_page = get_post(woocommerce_get_page_id('shop'));
                echo apply_filters('the_title', ($shop_page_title = get_option('woocommerce_shop_page_title')) ? $shop_page_title : $shop_page->post_title);
                ?>
				<?php 
            }
            ?>
				
				<?php 
            if (get_query_var('paged')) {
                ?>
					<?php 
                printf(__('&nbsp;&ndash; Page %s', 'woocommerce'), get_query_var('paged'));
                ?>
				<?php 
            }
            ?>
			</h1>
					
			<?php 
            if (is_tax()) {
                ?>
				<?php 
                echo '<div class="term-description">' . wpautop(wptexturize(term_description())) . '</div>';
                ?>
			<?php 
            } elseif (!is_search() && !empty($shop_page) && is_object($shop_page)) {
                ?>
				<?php 
                echo '<div class="page-description">' . apply_filters('the_content', $shop_page->post_content) . '</div>';
                ?>
			<?php 
            }
            ?>
			
			<?php 
            if (have_posts()) {
                ?>
			
				<?php 
                do_action('woocommerce_before_shop_loop');
                ?>
			
				<ul class="products">
				
					<?php 
                woocommerce_product_subcategories();
                ?>
			
					<?php 
                while (have_posts()) {
                    the_post();
                    ?>
			
						<?php 
                    woocommerce_get_template_part('content', 'product');
                    ?>
			
					<?php 
                }
                // end of the loop.
                ?>
					
				</ul>
	
				<?php 
                do_action('woocommerce_after_shop_loop');
                ?>
			
			<?php 
            } else {
                ?>
			
				<?php 
                if (!woocommerce_product_subcategories(array('before' => '<ul class="products">', 'after' => '</ul>'))) {
                    ?>
						
					<p><?php 
                    _e('No products found which match your selection.', 'woocommerce');
                    ?>
</p>
						
				<?php 
                }
                ?>
			
			<?php 
            }
            ?>
			
			<div class="clear"></div>
				
			<?php 
            do_action('woocommerce_pagination');
        }
    }
    /** @see WP_Widget::widget */
    function widget($args, $instance)
    {
        extract($args);
        $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title']);
        $showposts = apply_filters('widget_showpost', empty($instance['showpost']) ? '' : $instance['showpost']);
        $type = apply_filters('widget_type', empty($instance['type']) ? '' : $instance['type']);
        $customclass = apply_filters('widget_customclass', empty($instance['customclass']) ? '' : $instance['customclass']);
        $show_variations = $instance['show_variations'] ? '1' : '0';
        $text = isset($instance['text']) ? $instance['text'] : false;
        $wpautop = isset($instance['wpautop']) ? $instance['wpautop'] : false;
        if ($customclass) {
            $before_widget = str_replace('class="', 'class="' . $customclass . ' ', $before_widget);
        }
        global $wp_query, $woocommerce;
        ?>
              <?php 
        echo $before_widget;
        echo '
					    <div class="all-widget-wrapper">
                		<div class="container">
                    	<div class="row">
                        <div class="twelve columns">
					 ';
        echo '<div class="klasik-wooproduct-widget-wrapper">';
        $titleline = '<span class="line-wrap-title"><span class="line-title"></span></span>';
        if ($title != '') {
            echo $before_title . esc_html($title) . $titleline . $after_title;
        }
        $showposts = !is_numeric($showposts) ? get_option('posts_per_page') : $showposts;
        //$categories = $cats;
        // Echo the text
        if ($text) {
            if ($wpautop == "on") {
                $text = wpautop($text);
            }
            echo '<div class="wooproduct-text">' . $text . '</div>';
        }
        echo '<div class="klasik-product woocommerce ' . $customclass . '">';
        $temp = $wp_query;
        $wp_query = null;
        $wp_query = new WP_Query();
        if ($type == 'latest-product') {
            $query_args = array('posts_per_page' => $showposts, 'no_found_rows' => 1, 'post_status' => 'publish', 'post_type' => 'product');
            $query_args['meta_query'] = array();
            if ($show_variations == '0') {
                $query_args['meta_query'][] = $woocommerce->query->visibility_meta_query();
                $query_args['parent'] = '0';
            }
            $query_args['meta_query'][] = $woocommerce->query->stock_status_meta_query();
            $query_args['meta_query'] = array_filter($query_args['meta_query']);
        } elseif ($type == 'featured-product') {
            $query_args = array('posts_per_page' => $showposts, 'no_found_rows' => 1, 'post_status' => 'publish', 'post_type' => 'product');
            $query_args['meta_query'] = $woocommerce->query->get_meta_query();
            $query_args['meta_query'][] = array('key' => '_featured', 'value' => 'yes');
        } else {
            $query_args = array('posts_per_page' => $showposts, 'post_status' => 'publish', 'post_type' => 'product', 'meta_key' => 'total_sales', 'orderby' => 'meta_value_num', 'no_found_rows' => 1);
            $query_args['meta_query'] = $woocommerce->query->get_meta_query();
            if (isset($instance['hide_free']) && 1 == $instance['hide_free']) {
                $query_args['meta_query'][] = array('key' => '_price', 'value' => 0, 'compare' => '>', 'type' => 'DECIMAL');
            }
        }
        $wp_query->query($query_args);
        global $post;
        if ($wp_query->have_posts()) {
            $x = 0;
            $output = "";
            echo '<ul class="row products">';
            while ($wp_query->have_posts()) {
                $wp_query->the_post();
                woocommerce_get_template_part('content', 'product');
                $x++;
            }
            echo '</ul>';
            $wp_query = null;
            $wp_query = $temp;
            wp_reset_query();
        }
        $wp_query = null;
        $wp_query = $temp;
        wp_reset_query();
        echo '<div class="clear"></div>';
        echo '</div>';
        echo '<div class="clear"></div></div>';
        echo '                        
					</div>
					</div>
					</div>
					<div class="clear"></div></div>';
        ?>
			
              <?php 
        echo $after_widget;
        ?>
			 
        <?php 
    }
Пример #29
0
function miss_woocommerce_content()
{
    if (is_singular('product')) {
        while (have_posts()) {
            the_post();
            woocommerce_get_template_part('content', 'single-product');
        }
    } else {
        ?>

		<?php 
        if (apply_filters('woocommerce_show_page_title', true)) {
            ?>
            <div class="bread-container">
                <div class="bread-wrapper">
                    <div class="blog-title"><?php 
            woocommerce_page_title();
            ?>
</div>
                    <?php 
            dimox_breadcrumbs();
            ?>
                </div>
            </div>

		<?php 
        }
        ?>

		<?php 
        do_action('woocommerce_archive_description');
        ?>

		<?php 
        if (have_posts()) {
            ?>

			<?php 
            do_action('woocommerce_before_shop_loop');
            ?>

			<?php 
            woocommerce_product_loop_start();
            ?>

				<?php 
            woocommerce_product_subcategories();
            ?>

				<?php 
            while (have_posts()) {
                the_post();
                ?>

					<?php 
                woocommerce_get_template_part('content', 'product');
                ?>

				<?php 
            }
            // end of the loop.
            ?>

			<?php 
            woocommerce_product_loop_end();
            ?>

			<?php 
            do_action('woocommerce_after_shop_loop');
            ?>

		<?php 
        } elseif (!woocommerce_product_subcategories(array('before' => woocommerce_product_loop_start(false), 'after' => woocommerce_product_loop_end(false)))) {
            ?>

			<?php 
            woocommerce_get_template('loop/no-products-found.php');
            ?>

		<?php 
        }
    }
}
Пример #30
0
 public function html()
 {
     global $woocommerce, $woocommerce_loop;
     $output = "";
     global $avia_config;
     $output = "";
     avia_post_slider::$slide++;
     extract($this->atts);
     $extraClass = 'first';
     $grid = 'one_third';
     $image_size = 'portfolio';
     $post_loop_count = 1;
     $loop_counter = 1;
     $autoplay = $autoplay == "no" ? false : true;
     $total = $columns % 2 ? "odd" : "even";
     $woocommerce_loop['columns'] = $columns;
     switch ($columns) {
         case "1":
             $grid = 'av_fullwidth';
             $image_size = 'large';
             break;
         case "2":
             $grid = 'av_one_half';
             break;
         case "3":
             $grid = 'av_one_third';
             break;
         case "4":
             $grid = 'av_one_fourth';
             $image_size = 'portfolio_small';
             break;
         case "5":
             $grid = 'av_one_fifth';
             $image_size = 'portfolio_small';
             break;
     }
     $data = AviaHelper::create_data_string(array('autoplay' => $autoplay, 'interval' => $interval, 'animation' => $animation, 'hoverpause' => 1));
     ob_start();
     if (have_posts()) {
         echo "<div {$data} class='template-shop avia-content-slider avia-content-{$type}-active avia-content-slider" . avia_post_slider::$slide . " avia-content-slider-{$total} {$class} shop_columns_{$columns}' >";
         if ($sort == "dropdown") {
             avia_woocommerce_frontend_search_params();
         }
         echo "<div class='avia-content-slider-inner'>";
         if ($type == 'grid') {
             echo '<ul class="products">';
         }
         while (have_posts()) {
             the_post();
             if ($loop_counter == 1 && $type == 'slider') {
                 echo '<ul class="products slide-entry-wrap">';
             }
             woocommerce_get_template_part('content', 'product');
             $loop_counter++;
             $post_loop_count++;
             if ($loop_counter > $columns) {
                 $loop_counter = 1;
             }
             if ($loop_counter == 1 && $type == 'slider') {
                 echo '</ul>';
             }
         }
         // end of the loop.
         if ($loop_counter != 1 || $type == 'grid') {
             echo '</ul>';
         }
         echo "</div>";
         if ($post_loop_count - 1 > $columns && $type == 'slider') {
             echo $this->slide_navigation_arrows();
         }
         echo "</div>";
     } else {
         if (!woocommerce_product_subcategories(array('before' => '<ul class="products">', 'after' => '</ul>'))) {
             echo "<p>" . __('No products found which match your selection.', 'woocommerce') . "</p>";
         }
     }
     echo '<div class="clear"></div>';
     $products = ob_get_clean();
     $output .= $products;
     if ($paginate == "yes" && ($avia_pagination = avia_pagination('', 'nav'))) {
         $output .= "<div class='pagination-wrap pagination-slider'>{$avia_pagination}</div>";
     }
     wp_reset_query();
     return $output;
 }