当前位置: 首页>>代码示例>>PHP>>正文


PHP woocommerce_product_loop_end函数代码示例

本文整理汇总了PHP中woocommerce_product_loop_end函数的典型用法代码示例。如果您正苦于以下问题:PHP woocommerce_product_loop_end函数的具体用法?PHP woocommerce_product_loop_end怎么用?PHP woocommerce_product_loop_end使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了woocommerce_product_loop_end函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: output_featured_products

    function output_featured_products()
    {
        $args = array('post_type' => 'product', 'posts_per_page' => 3, 'product_tag' => 'featured', 'orderby' => 'rand');
        $products = new WP_Query($args);
        if ($products->have_posts()) {
            ?>
		<div class="related products">
			<h2><?php 
            _e('Featured Products', 'woocommerce');
            ?>
</h2>
			<?php 
            woocommerce_product_loop_start();
            ?>
				<?php 
            while ($products->have_posts()) {
                $products->the_post();
                ?>
					<?php 
                wc_get_template_part('content', 'product');
                ?>
				<?php 
            }
            // end of the loop.
            ?>
			<?php 
            woocommerce_product_loop_end();
            ?>
		</div>
	<?php 
        }
        wp_reset_postdata();
    }
开发者ID:developmentDM2,项目名称:The-Haute-Mess,代码行数:33,代码来源:woocommerce.php

示例2: content

 protected function content($atts, $content = null)
 {
     $atts = shortcode_atts(array('product_type' => 'classic', 'product_effect' => '', 'desktop' => 4, 'per_page' => 10, 'orderby' => 'date', 'meta_key' => '', 'order' => 'DESC', 'source' => 'all', 'categories' => '', 'products' => '', 'operator' => 'IN', 'css_animation' => '', 'el_class' => '', 'css' => ''), $atts);
     extract($atts);
     $elementClass = array('base' => apply_filters(VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, 'cruxstore-products', $this->settings['base'], $atts), 'extra' => $this->getExtraClass($el_class), 'css_animation' => $this->getCSSAnimation($css_animation), 'shortcode_custom' => vc_shortcode_custom_css_class($css, ' '), 'product_stype' => 'cruxstore-products-' . $product_type, 'woocommerce' => 'woocommerce columns-' . $desktop);
     $meta_query = WC()->query->get_meta_query();
     if ($source == 'best-sellers') {
         $meta_key = 'total_sales';
         $orderby = 'meta_value_num';
     }
     $args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $per_page, 'meta_query' => $meta_query, 'order' => $order, 'orderby' => $orderby, 'meta_key' => $meta_key);
     if ($source == 'onsale') {
         $product_ids_on_sale = wc_get_product_ids_on_sale();
         $args['post__in'] = array_merge(array(0), $product_ids_on_sale);
     } elseif ($source == 'featured') {
         $args['meta_query'][] = array('key' => '_featured', 'value' => 'yes');
     } elseif ($source == 'top-rated') {
         add_filter('posts_clauses', array(__CLASS__, 'order_by_rating_post_clauses'));
     } elseif ($source == 'categories') {
         if (!empty($categories)) {
             $args['tax_query'] = array(array('taxonomy' => 'product_cat', 'terms' => array_map('sanitize_title', explode(',', $categories)), 'field' => 'slug', 'operator' => $operator));
         }
     } elseif ($source == 'products') {
         if (!empty($atts['products'])) {
             $args['post__in'] = array_map('trim', explode(',', $atts['products']));
         }
     }
     $output = '';
     ob_start();
     global $woocommerce_loop;
     $products = new WP_Query(apply_filters('woocommerce_shortcode_products_query', $args, $atts));
     if ($product_type != 'classic') {
         $product_effect = '';
     }
     $woocommerce_loop['columns'] = $desktop;
     $woocommerce_loop['type'] = $product_type;
     $woocommerce_loop['effect'] = $product_effect;
     if ($products->have_posts()) {
         woocommerce_product_loop_start();
         if ($product_type == 'masonry') {
             echo '<div class="clearfix product col-sm-3 grid-sizer"></div>';
         }
         while ($products->have_posts()) {
             $products->the_post();
             wc_get_template_part('content', 'product');
         }
         // end of the loop.
         woocommerce_product_loop_end();
     }
     wp_reset_postdata();
     if ($source == 'top-rated') {
         remove_filter('posts_clauses', array(__CLASS__, 'order_by_rating_post_clauses'));
     }
     $output .= ob_get_clean();
     $elementClass = preg_replace(array('/\\s+/', '/^\\s|\\s$/'), array(' ', ''), implode(' ', $elementClass));
     return '<div class="' . esc_attr($elementClass) . '">' . $output . '</div>';
 }
开发者ID:websideas,项目名称:Mondova,代码行数:57,代码来源:products.php

示例3: content

 protected function content($atts, $content = null)
 {
     $atts = shortcode_atts(array('per_page' => 10, 'orderby' => 'date', 'meta_key' => '', 'order' => 'DESC', 'source' => '', 'categories' => '', 'products' => '', 'operator' => 'IN', 'layout' => 'normal', 'autoheight' => true, 'autoplay' => false, 'mousedrag' => true, 'autoplayspeed' => 5000, 'slidespeed' => 200, 'carousel_skin' => '', 'desktop' => 4, 'desktopsmall' => 3, 'tablet' => 2, 'mobile' => 1, 'gutters' => false, 'navigation' => true, 'navigation_always_on' => false, 'navigation_position' => 'center-outside', 'navigation_style' => 'normal', 'pagination' => false, 'pagination_position' => 'center-bottom', 'pagination_style' => 'dot-stroke', 'css_animation' => '', 'el_class' => '', 'css' => ''), $atts);
     extract($atts);
     $elementClass = array('base' => apply_filters(VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, 'products-carousel ', $this->settings['base'], $atts), 'extra' => $this->getExtraClass($el_class), 'css_animation' => $this->getCSSAnimation($css_animation), 'woocommerce' => 'woocommerce columns-' . $desktop, 'shortcode_custom' => vc_shortcode_custom_css_class($css, ' '), 'layout' => 'layout-' . $layout);
     $meta_query = WC()->query->get_meta_query();
     if ($source == 'best-sellers') {
         $meta_key = 'total_sales';
         $orderby = 'meta_value_num';
     }
     $args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $per_page, 'meta_query' => $meta_query, 'order' => $order, 'orderby' => $orderby, 'meta_key' => $meta_key);
     if ($source == 'onsale') {
         $product_ids_on_sale = wc_get_product_ids_on_sale();
         $args['post__in'] = array_merge(array(0), $product_ids_on_sale);
     } elseif ($source == 'featured') {
         $args['meta_query'][] = array('key' => '_featured', 'value' => 'yes');
     } elseif ($source == 'top-rated') {
         add_filter('posts_clauses', array(__CLASS__, 'order_by_rating_post_clauses'));
     } elseif ($source == 'categories') {
         if (!empty($categories)) {
             $args['tax_query'] = array(array('taxonomy' => 'product_cat', 'terms' => array_map('sanitize_title', explode(',', $categories)), 'field' => 'slug', 'operator' => $operator));
         }
     } elseif ($source == 'products') {
         if (!empty($atts['products'])) {
             $args['post__in'] = array_map('trim', explode(',', $atts['products']));
         }
     }
     $output = $carousel_html = '';
     ob_start();
     $products = new WP_Query(apply_filters('woocommerce_shortcode_products_query', $args, $atts));
     if ($products->have_posts()) {
         global $woocommerce_loop;
         $woocommerce_loop['columns'] = $desktop;
         $carousel_ouput = cruxstore_render_carousel(apply_filters('cruxstore_render_args', $atts), '', 'wc-carousel-wrapper');
         if ($layout == 'transparent') {
             $woocommerce_loop['type'] = 'transparent';
         } else {
             $woocommerce_loop['type'] = 'normal';
         }
         woocommerce_product_loop_start();
         while ($products->have_posts()) {
             $products->the_post();
             wc_get_template_part('content', 'product');
         }
         // end of the loop.
         woocommerce_product_loop_end();
     }
     $carousel_html .= ob_get_clean();
     wp_reset_postdata();
     if ($carousel_html) {
         $elementClass = preg_replace(array('/\\s+/', '/^\\s|\\s$/'), array(' ', ''), implode(' ', $elementClass));
         $output = '<div class="' . esc_attr($elementClass) . '">' . str_replace('%carousel_html%', $carousel_html, $carousel_ouput) . '</div>';
     }
     return $output;
 }
开发者ID:websideas,项目名称:Mondova,代码行数:55,代码来源:products_carousel.php

示例4: new_products_lightspeed

function new_products_lightspeed($atts)
{
    /**
     * Featured Products shortcode
     *
     * @param array $atts
     * @return string
     */
    global $woocommerce_loop, $products, $product;
    // include our handy API wrapper that makes it easy to call the API, it also depends on MOScURL to make the cURL call
    require_once "MOSAPICall.class.php";
    extract(shortcode_atts(array('per_page' => '12', 'columns' => '4', 'orderby' => 'date', 'order' => 'desc'), $atts));
    $woocommerce_loop['columns'] = $columns;
    ob_start();
    $mosapi = new MOSAPICall("992e498dfa5ab5245f5bd5afee4ee1ce6ac6e0a1ee7d11e36480694a9b5282e7", "83442");
    $emitter = 'https://api.merchantos.com/API/Account/83442/ItemMatrix';
    $xml_query_string = 'limit=100&orderby=timeStamp&orderby_desc=1&load_relations=["ItemECommerce","Tags","Images"]';
    $products = $mosapi->makeAPICall("Account.ItemMatrix", "Read", null, null, $emitter, $xml_query_string);
    $wp_session = WP_Session::get_instance();
    $products = xml2array($products);
    $wp_session['products'] = $products;
    //var_dump($wp_session['products']);
    $i = 0;
    //if ( $products->children() ) :
    ?>

		<?php 
    woocommerce_product_loop_start();
    ?>

			<?php 
    foreach ($products as $prod) {
        foreach ($prod as $product) {
            wc_get_template_part('content', 'lightspeedproduct');
        }
    }
    // end of the loop.
    ?>

		<?php 
    woocommerce_product_loop_end();
    ?>

	<?php 
    //endif;
    return '<div class="woocommerce columns-' . $columns . '">' . ob_get_clean() . '</div>';
}
开发者ID:Inteleck,项目名称:hwc,代码行数:47,代码来源:new_products.php

示例5: content

 protected function content($atts, $content = null)
 {
     $atts = shortcode_atts(array('desktop' => 3, 'per_page' => 10, 'orderby' => 'date', 'meta_key' => '', 'order' => 'DESC', 'source' => 'all', 'categories' => '', 'products' => '', 'operator' => 'IN', 'css_animation' => '', 'el_class' => '', 'css' => ''), $atts);
     extract($atts);
     $elementClass = array('base' => apply_filters(VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, 'cruxstore-products-countdown', $this->settings['base'], $atts), 'extra' => $this->getExtraClass($el_class), 'css_animation' => $this->getCSSAnimation($css_animation), 'woocommerce' => 'woocommerce columns-' . $desktop, 'shortcode_custom' => vc_shortcode_custom_css_class($css, ' '));
     $meta_query = WC()->query->get_meta_query();
     $product_ids_on_sale = wc_get_product_ids_on_sale();
     $args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $atts['per_page'], 'meta_query' => $meta_query, 'order' => $order, 'orderby' => $orderby, 'meta_key' => $meta_key, 'post__in' => array_merge(array(0), $product_ids_on_sale));
     if ($source == 'categories') {
         if (!empty($categories)) {
             $args['tax_query'] = array(array('taxonomy' => 'product_cat', 'terms' => array_map('sanitize_title', explode(',', $categories)), 'field' => 'slug', 'operator' => $operator));
         }
     } elseif ($source == 'products') {
         if (!empty($atts['products'])) {
             $args['post__in'] = array_map('trim', explode(',', $atts['products']));
         }
     }
     $output = '';
     ob_start();
     global $woocommerce_loop;
     $products = new WP_Query(apply_filters('woocommerce_shortcode_products_query', $args, $atts));
     $woocommerce_loop['columns'] = $desktop;
     $woocommerce_loop['type'] = 'countdown';
     if ($products->have_posts()) {
         woocommerce_product_loop_start();
         while ($products->have_posts()) {
             $products->the_post();
             wc_get_template_part('content', 'product_sale');
         }
         // end of the loop.
         woocommerce_product_loop_end();
     }
     wp_reset_postdata();
     $output .= ob_get_clean();
     $elementClass = preg_replace(array('/\\s+/', '/^\\s|\\s$/'), array(' ', ''), implode(' ', $elementClass));
     return '<div class="' . esc_attr($elementClass) . '">' . $output . '</div>';
 }
开发者ID:websideas,项目名称:Mondova,代码行数:37,代码来源:products_sale_countdown.php

示例6: output

    /**
     * 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>";
    }
开发者ID:Omuze,项目名称:barakat,代码行数:75,代码来源:woocommerce-simple-auctions-shortcode-my-auctions.php

示例7: woocomposer_grid_shortcode


//.........这里部分代码省略.........
            }
            $woocommerce_loop['columns'] = $columns;
            ob_start();
            // Reset loop/columns globals when starting a new loop
            $woocommerce_loop['loop'] = $woocommerce_loop['column'] = '';
            if ($product_categories) {
                //woocommerce_product_loop_start();
                echo '<ul class="wcmp-cat-grid products">';
                foreach ($product_categories as $category) {
                    // Store loop count we're currently on
                    if (empty($woocommerce_loop['loop'])) {
                        $woocommerce_loop['loop'] = 0;
                    }
                    // Store column count for displaying the grid
                    if (empty($woocommerce_loop['columns'])) {
                        $woocommerce_loop['columns'] = apply_filters('loop_shop_columns', 4);
                    }
                    // Increase loop count
                    $woocommerce_loop['loop']++;
                    ?>
					<li class="product-category product<?php 
                    if (($woocommerce_loop['loop'] - 1) % $woocommerce_loop['columns'] == 0 || $woocommerce_loop['columns'] == 1) {
                        echo ' first';
                    }
                    if ($woocommerce_loop['loop'] % $woocommerce_loop['columns'] == 0) {
                        echo ' last';
                    }
                    ?>
">
                        
                        <div class="wcmp-product wcmp-img-<?php 
                    echo $img_animate;
                    ?>
 wcmp-cat-<?php 
                    echo $design_style . ' animated ' . $product_animation;
                    ?>
" style="<?php 
                    echo $border;
                    ?>
">     
					
						<?php 
                    do_action('woocommerce_before_subcategory', $category);
                    ?>
                        
					
                          <a href="<?php 
                    echo get_term_link($category->slug, 'product_cat');
                    ?>
" style="text-align:<?php 
                    echo $text_align;
                    ?>
;">
							
                            <div class="wcmp-product-image">
							<?php 
                    /**
                     * woocommerce_before_subcategory_title hook
                     *
                     * @hooked woocommerce_subcategory_thumbnail - 10
                     */
                    do_action('woocommerce_before_subcategory_title', $category);
                    ?>
                            </div><!--.wcmp-product-image-->
					
							<h3 style="<?php 
                    echo $size;
                    ?>
">
								<?php 
                    echo $category->name;
                    if ($category->count > 0) {
                        echo apply_filters('woocommerce_subcategory_count_html', ' <mark class="count" style="' . $count_style . '">' . $category->count . ' ' . $cat_count . '</mark>', $category);
                    }
                    ?>
							</h3>
					
							<?php 
                    /**
                     * woocommerce_after_subcategory_title hook
                     */
                    do_action('woocommerce_after_subcategory_title', $category);
                    ?>
					
						</a>
                        
						<?php 
                    do_action('woocommerce_after_subcategory', $category);
                    ?>
                        
                        </div><!--.wcmp-product-->
					
					</li>	
	<?php 
                }
                woocommerce_product_loop_end();
            }
            woocommerce_reset_loop();
            return '<div class="woocommerce columns-' . $columns . '">' . ob_get_clean() . '</div>';
        }
开发者ID:cimocimocimo,项目名称:staydrysystems.com,代码行数:101,代码来源:shortcode_cat_grid.php

示例8: fruitful_woocommerce_cross_sell_display

        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();
        }
开发者ID:saki1001,项目名称:sj-2015,代码行数:44,代码来源:functions.php

示例9: wr_ferado_product_slider


//.........这里部分代码省略.........
				<div id="<?php 
                echo $id;
                ?>
" class="owl-carousel <?php 
                echo $class;
                ?>
">

					<?php 
                while ($products->have_posts()) {
                    $products->the_post();
                    global $product;
                    $cat_count = sizeof(get_the_terms($post->ID, 'product_cat'));
                    $tag_count = sizeof(get_the_terms($post->ID, 'product_tag'));
                    ?>
							<li <?php 
                    post_class();
                    ?>
>

								<div class="p-inner">

									<div class="p-grid">
										<span class="p-image">
											<?php 
                    if (class_exists('YITH_WCWL_UI')) {
                        echo wr_ferado_wishlist_button();
                    }
                    do_action('woocommerce_before_shop_loop_item_title');
                    ?>
											<div class="p-mask">
												<h3><a href="<?php 
                    the_permalink();
                    ?>
"><?php 
                    the_title();
                    ?>
</a></h3>
												<?php 
                    woocommerce_get_template('loop/rating.php');
                    ?>
												<span class="p-desc">
													<?php 
                    if (!apply_filters('woocommerce_short_description', $post->post_excerpt)) {
                        $content = $post->post_content;
                        echo wp_trim_words(wpautop($content), 15);
                    } else {
                        echo wp_trim_words(apply_filters('woocommerce_short_description', $post->post_excerpt), 15);
                    }
                    ?>
												</span>
												<?php 
                    if (wc_product_sku_enabled() && ($product->get_sku() || $product->is_type('variable'))) {
                        ?>
													<span class="sku_wrapper"><?php 
                        _e('SKU:', 'woocommerce');
                        ?>
 <span class="sku" itemprop="sku"><?php 
                        echo ($sku = $product->get_sku()) ? $sku : __('N/A', 'woocommerce');
                        ?>
</span>.</span>
												<?php 
                    }
                    ?>
													<?php 
                    echo $product->get_categories(', ', '<span class="posted_in">' . _n('Category:', 'Categories:', $cat_count, 'woocommerce') . ' ', '.</span>');
                    ?>
												<?php 
                    echo $product->get_tags(', ', '<span class="tagged_as">' . _n('Tag:', 'Tags:', $tag_count, 'woocommerce') . ' ', '.</span>');
                    ?>
											</div>
										</span>
										<span class="p-info">
											<div class="p-cart">
												<?php 
                    woocommerce_get_template('loop/add-to-cart.php');
                    ?>
											</div>
											<?php 
                    do_action('woocommerce_after_shop_loop_item_title');
                    ?>
										</span>
									</div>
								</div>
							</li>
							<?php 
                }
                ?>

				</div>

				<?php 
                if (function_exists('woocommerce_product_loop_end')) {
                    woocommerce_product_loop_end();
                }
            }
            // Restore original Post Data
            wp_reset_postdata();
            return '<div class="woocommerce product-slider">' . ob_get_clean() . '</div>';
        }
开发者ID:JaneJieYing,项目名称:HiFridays,代码行数:101,代码来源:product_slider.php

示例10: etheme_products

    function etheme_products($args, $title = false, $columns = 4)
    {
        global $wpdb, $woocommerce_loop;
        ob_start();
        $products = new WP_Query($args);
        $class = $title_output = '';
        $shop_url = get_permalink(woocommerce_get_page_id('shop'));
        if ($title != '') {
            $title_output = '<h2 class="title"><span>' . $title . '</span></h2>';
        }
        $woocommerce_loop['columns'] = $columns;
        if ($products->have_posts()) {
            echo $title_output;
            ?>
            <?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>';
    }
开发者ID:EmmaTope,项目名称:gadafunds,代码行数:41,代码来源:theme-functions.php

示例11: woocommerce_content

    /**
     * Output WooCommerce content.
     *
     * This function is only used in the optional 'woocommerce.php' template.
     * which people can add to their themes to add basic woocommerce support.
     * without hooks or modifying core templates.
     *
     */
    function woocommerce_content()
    {
        if (is_singular('product')) {
            while (have_posts()) {
                the_post();
                wc_get_template_part('content', 'single-product');
            }
        } else {
            ?>

			<?php 
            if (apply_filters('woocommerce_show_page_title', true)) {
                ?>

				<h1 class="page-title"><?php 
                woocommerce_page_title();
                ?>
</h1>

			<?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 
                    wc_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 
                do_action('woocommerce_no_products_found');
                ?>

			<?php 
            }
        }
    }
开发者ID:woocommerce,项目名称:woocommerce,代码行数:85,代码来源:wc-template-functions.php

示例12: woof_products


//.........这里部分代码省略.........
            global $WOOCS;
            if (!method_exists($WOOCS, 'woocs_convert_currency')) {
                if (class_exists('WOOCS') and defined('DOING_AJAX')) {
                    //IT IS OBSOLETE AND NOT RIGHT ALREADY FROM X.0.9 VERSIONS
                    //add_filter('raw_woocommerce_price', array($this, 'raw_woocommerce_price'), 1001);
                    //add_filter('woocommerce_currency_symbol', array($this, 'woocommerce_currency_symbol'), 1001);
                }
            }
            ?>



            <?php 
            //products output
            if ($dp == 0) {
                //Display Product for WooCommerce compatibility
                while ($products->have_posts()) {
                    $products->the_post();
                    wc_get_template_part('content', 'product');
                }
                // end of the loop.
            } else {
                echo do_shortcode('[displayProduct id="' . $dp . '"]');
            }
            ?>



            <?php 
            wc_get_template('loop/loop-end.php');
            ?>

                    <?php 
            if (function_exists('woocommerce_product_loop_end')) {
                woocommerce_product_loop_end();
            }
            ?>

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

                </div>


            <?php 
        } else {
            if ($is_ajax == 1) {
                ?>
                        <div id="woof_results_by_ajax" class="woof_results_by_ajax_shortcode" data-shortcode="<?php 
                echo $shortcode_txt;
                ?>
">
                        <?php 
            }
            ?>
                    <div class="woocommerce woocommerce-page woof_shortcode_output">

            <?php 
            if (!$is_ajax) {
                wc_get_template('loop/no-products-found.php');
            } else {
                ?>
                            <div id="woof_results_by_ajax" class="woof_results_by_ajax_shortcode" data-shortcode="<?php 
                echo $shortcode_txt;
                ?>
开发者ID:donpapa26,项目名称:bakancslistad,代码行数:67,代码来源:index.php

示例13: product

    /**
     * Display a single product.
     *
     * @param array $atts
     * @return string
     */
    public static function product($atts)
    {
        if (empty($atts)) {
            return '';
        }
        $meta_query = WC()->query->get_meta_query();
        $args = array('post_type' => 'product', 'posts_per_page' => 1, 'no_found_rows' => 1, 'post_status' => 'publish', 'meta_query' => $meta_query);
        if (isset($atts['sku'])) {
            $args['meta_query'][] = array('key' => '_sku', 'value' => $atts['sku'], 'compare' => '=');
        }
        if (isset($atts['id'])) {
            $args['p'] = $atts['id'];
        }
        ob_start();
        $products = new WP_Query(apply_filters('woocommerce_shortcode_products_query', $args, $atts));
        if ($products->have_posts()) {
            ?>

			<?php 
            woocommerce_product_loop_start();
            ?>

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

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

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

			<?php 
            woocommerce_product_loop_end();
            ?>

		<?php 
        }
        wp_reset_postdata();
        $css_class = 'woocommerce';
        if (isset($atts['class'])) {
            $css_class .= ' ' . $atts['class'];
        }
        return '<div class="' . esc_attr($css_class) . '">' . ob_get_clean() . '</div>';
    }
开发者ID:seriusokhatsky,项目名称:woocommerce,代码行数:55,代码来源:class-wc-shortcodes.php

示例14: content

 protected function content($atts, $content = null)
 {
     $atts = shortcode_atts(array('title' => esc_html__('Title', 'js_composer'), 'source' => 'widgets', 'categories' => '', 'per_page' => 8, 'orderby' => 'date', 'order' => 'DESC', 'style' => 1, 'active_section' => 1, 'font_size' => '', 'line_height' => '', 'letter_spacing' => '', 'font_container' => '', 'use_theme_fonts' => 'yes', 'google_fonts' => '', 'css_animation' => '', 'el_class' => '', 'css' => '', 'operator' => 'IN'), $atts);
     $columns = 3;
     $product_type = 'classic';
     // This is needed to extract $font_container_data and $google_fonts_data
     extract($this->getAttributes($atts));
     unset($font_container_data['values']['text_align']);
     $atts = vc_map_get_attributes($this->getShortcode(), $atts);
     extract($atts);
     extract($this->getStyles($el_class, $css, $google_fonts_data, $font_container_data, $atts));
     $settings = get_option('wpb_js_google_fonts_subsets');
     if (is_array($settings) && !empty($settings)) {
         $subsets = '&subset=' . implode(',', $settings);
     } else {
         $subsets = '';
     }
     if (isset($google_fonts_data['values']['font_family'])) {
         wp_enqueue_style('vc_google_fonts_' . vc_build_safe_css_class($google_fonts_data['values']['font_family']), '//fonts.googleapis.com/css?family=' . $google_fonts_data['values']['font_family'] . $subsets);
     }
     if ($letter_spacing) {
         if (empty($styles)) {
             $styles = array();
         }
         $styles[] = 'letter-spacing: ' . $letter_spacing . 'px';
     }
     if (!empty($styles)) {
         $style = 'style="' . esc_attr(implode(';', $styles)) . '"';
     } else {
         $style = '';
     }
     $elementClass = array('base' => apply_filters(VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, 'wc-products-vertical', $this->settings['base'], $atts), 'extra' => $this->getExtraClass($el_class), 'css_animation' => $this->getCSSAnimation($css_animation), 'shortcode_custom' => vc_shortcode_custom_css_class($css, ' '), 'product_stype' => 'cruxstore-products cruxstore-products-classic', 'woocommerce' => 'woocommerce columns-' . $columns);
     if (!$active_section) {
         $active_section = 1;
     }
     $uniqeID = uniqid();
     $meta_query = WC()->query->get_meta_query();
     $args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $atts['per_page'], 'meta_query' => $meta_query);
     if ($source == 'categories') {
         $tabs = explode(',', $categories);
         $args['order'] = $order;
         $args['orderby'] = $orderby;
     } else {
         $tabs = array('onsale', 'new', 'bestselling');
     }
     $tab_heading = '<ul class="nav-style" data-count="' . count($tabs) . '">';
     $i = 1;
     foreach ($tabs as $tab) {
         if ($source == 'categories') {
             $term = get_term_by('slug', sanitize_title($tab), 'product_cat');
             $text = $term->name;
         } else {
             if ($tab == 'new') {
                 $text = esc_html__('Arrivals Products', 'cruxstore');
             } elseif ($tab == 'bestselling') {
                 $text = esc_html__('Best Sellers', 'cruxstore');
             } elseif ($tab == 'onsale') {
                 $text = esc_html__('On sale', 'cruxstore');
             }
         }
         $class = $active_section == $i ? ' class="active"' : '';
         $tab_heading .= sprintf('<li %s><a href="%s" data-toggle="tab"><span data-hover="%s">%s</span></a></li>', $class, '#tab-' . $tab . '-' . $uniqeID, esc_attr($text), $text);
         $i++;
     }
     $tab_heading .= "</ul>";
     global $woocommerce_loop;
     $i = 1;
     $output_content = '';
     $carousel_atts = array('desktop' => $columns, 'navigation' => false, 'gutters' => false);
     $carousel_ouput = cruxstore_render_carousel(apply_filters('cruxstore_render_args', $carousel_atts), '', 'wc-carousel-wrapper');
     foreach ($tabs as $tab) {
         $new_args = $args;
         if ($source == 'categories') {
             $new_args['tax_query'] = array(array('taxonomy' => 'product_cat', 'terms' => sanitize_title($tab), 'field' => 'slug', 'operator' => $atts['operator']));
         } else {
             if ($tab == 'bestselling') {
                 $new_args['meta_key'] = 'total_sales';
                 $new_args['orderby'] = 'meta_value_num';
             } elseif ($tab == 'featured') {
                 $new_args['meta_query'][] = array('key' => '_featured', 'value' => 'yes');
             } elseif ($tab == 'onsale') {
                 $new_args['post__in'] = array_merge(array(0), wc_get_product_ids_on_sale());
             }
         }
         $products = new WP_Query(apply_filters('woocommerce_shortcode_products_query', $new_args, $atts));
         $woocommerce_loop['columns'] = $columns;
         $woocommerce_loop['type'] = $product_type;
         ob_start();
         if ($products->have_posts()) {
             woocommerce_product_loop_start();
             while ($products->have_posts()) {
                 $products->the_post();
                 wc_get_template_part('content', 'product');
             }
             // end of the loop.
             woocommerce_product_loop_end();
         }
         wp_reset_postdata();
         $carousel_html = ob_get_clean();
         $carousel_html = str_replace('%carousel_html%', $carousel_html, $carousel_ouput);
//.........这里部分代码省略.........
开发者ID:websideas,项目名称:Mondova,代码行数:101,代码来源:products_tab_vertical.php

示例15: woof_products


//.........这里部分代码省略.........
            ?>

                    <?php 
            global $woocommerce_loop;
            $woocommerce_loop['columns'] = $columns;
            $woocommerce_loop['loop'] = 0;
            //+++
            //wc_get_template('loop/loop-start.php');
            ?>



                    <?php 
            //products output
            if ($dp == 0) {
                //Display Product for WooCommerce compatibility
                while ($products->have_posts()) {
                    $products->the_post();
                    wc_get_template_part('content', 'product');
                }
                // end of the loop.
            } else {
                echo do_shortcode('[displayProduct id="' . $dp . '"]');
            }
            ?>



                    <?php 
            //wc_get_template('loop/loop-end.php');
            ?>

                    <?php 
            if (function_exists('woocommerce_product_loop_end')) {
                woocommerce_product_loop_end();
            }
            ?>

                    <?php 
            if ($show_loop_filters) {
                do_action('woocommerce_after_shop_loop');
            }
            ?>

                </div>


                <?php 
        } else {
            if ($is_ajax == 1) {
                ?>
                        <div id="woof_results_by_ajax" class="woof_results_by_ajax_shortcode" data-shortcode="<?php 
                echo $shortcode_txt;
                ?>
">
                            <?php 
            }
            ?>
                    <div class="woocommerce woocommerce-page woof_shortcode_output">

                        <?php 
            if (!$is_ajax) {
                wc_get_template('loop/no-products-found.php');
            } else {
                ?>
                            <div id="woof_results_by_ajax" class="woof_results_by_ajax_shortcode" data-shortcode="<?php 
开发者ID:Web-Ares,项目名称:shop-shablon,代码行数:67,代码来源:index.php


注:本文中的woocommerce_product_loop_end函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。