• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP woocommerce_get_template_part函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: woocommerce_product_taxonomy_content

    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');
    }
开发者ID:bidhanbaral,项目名称:fotodep_store,代码行数:30,代码来源:woocommerce-template.php


示例2: widget

    /**
     * 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;
    }
开发者ID:seoduda,项目名称:Patua,代码行数:53,代码来源:upsell-widget.php


示例3: sprintf

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();
?>
		
开发者ID:OpenDoorBrewCo,项目名称:odbc-wp-prod,代码行数:30,代码来源:content-shop.php


示例4: widget

    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 ); 
//.........这里部分代码省略.........
开发者ID:denMicon777,项目名称:my_repository,代码行数:101,代码来源:widget-product2.php


示例5: cg_woo_featured_products

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;
}
开发者ID:Inteleck,项目名称:hwc,代码行数:79,代码来源:woocommerce_product_sliders.php


示例6: woocommerce_featured_products

/**
 * 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();
}
开发者ID:rosslavery,项目名称:woocommerce,代码行数:15,代码来源:shortcode-init.php


示例7: widget

        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 
            }
        }
开发者ID:dkdelosreyes,项目名称:onefabshop,代码行数:85,代码来源:widget-cat-product.php


示例8: array

			</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 
开发者ID:sergioblanco86,项目名称:git-gitlab.com-kinivo-kinivo.com,代码行数:31,代码来源:cart.php


示例9: kad_carousel_shortcode_function


//.........这里部分代码省略.........
                           			</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") {
开发者ID:jeffreysbrother,项目名称:WordPress-integration,代码行数:67,代码来源:carousel_shortcodes.php


示例10: shop

 /**
  * 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;
 }
开发者ID:eddiewilson,项目名称:new-ke,代码行数:65,代码来源:helper-templates.php


示例11: ux_products


//.........这里部分代码省略.........
            <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;
}
开发者ID:bqevin,项目名称:wp-shopeasy,代码行数:101,代码来源:products.php


示例12: woocommerce_product_page_shortcode

/**
 * 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();
}
开发者ID:eddiewilson,项目名称:new-ke,代码行数:38,代码来源:shortcode-init.php


示例13: wd_top_rated_product

    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();
            ?>
//.........这里部分代码省略.........
开发者ID:mynein,项目名称:myne,代码行数:101,代码来源:top_rated_product.php


示例14: product_attribute

    /**
     * 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>';
    }
开发者ID:rongandat,项目名称:sallumeh,代码行数:48,代码来源:class-wc-shortcodes.php


示例15: etheme_woocommerce_recent_products

/**
 * 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();
}
开发者ID:donpapa26,项目名称:bakancslistad,代码行数:39,代码来源:woo.php


示例16: ux_custom_products

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;
}
开发者ID:javipaur,项目名称:TiendaVirtual,代码行数:94,代码来源:product_sliders.php


示例17: _e

<?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>
开发者ID:rajveerbeniwal,项目名称:rooms-dhkh,代码行数:25,代码来源:cross-sells.php


示例18: 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, 'me 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP woocommerce_login_form函数代码示例发布时间:2022-05-23
下一篇:
PHP woocommerce_get_template函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap