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

PHP wc_get_template_part函数代码示例

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

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



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

示例1: widget

        public function widget($args, $instance)
        {
            extract($args);
            extract($instance);
            $title = apply_filters('widget_title', $title);
            echo $before_widget;
            echo $before_title . $title . $after_title;
            $loop = pgl_woocommerce_query('deals', 1);
            ?>

                <div class="woocommerce">
                    <div class="inner-content">  
                            <?php 
            if ($loop->have_posts()) {
                while ($loop->have_posts()) {
                    $loop->the_post();
                    wc_get_template_part('content', 'product-deals');
                }
            }
            ?>
                    </div>
                </div>
            <?php 
            wp_reset_query();
            echo $after_widget;
        }
开发者ID:devmoonshine,项目名称:development,代码行数:26,代码来源:update.php


示例2: clea_patrice_sold_out_shortcode

function clea_patrice_sold_out_shortcode($atts)
{
    // allow sold out products in the query...
    remove_action('pre_get_posts', 'clea_patrice_no_sold_out_in_shop');
    global $woocommerce_loop;
    extract(shortcode_atts(array('per_page' => '12', 'columns' => '3', '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' => '_stock_status', 'value' => 'outofstock', 'compare' => '=')));
    // Buffer our contents
    ob_start();
    do_action('woocommerce_before_shop_loop');
    $loop = new WP_Query($args);
    if ($loop->have_posts()) {
        while ($loop->have_posts()) {
            $loop->the_post();
            wc_get_template_part('content', 'product');
        }
    } else {
        echo __('No products found');
    }
    wp_reset_postdata();
    do_action('woocommerce_after_shop_loop');
    // Return buffered contents
    return '<ul class="products">' . ob_get_clean() . '</ul>';
}
开发者ID:aldelpech,项目名称:clea-patrice,代码行数:25,代码来源:clea-patrice-soldout-page.php


示例3: ro_woocommerce_content

 function ro_woocommerce_content()
 {
     if (is_singular('product')) {
         wc_get_template_part('single', 'product');
     } else {
         wc_get_template_part('archive', 'product');
     }
 }
开发者ID:tldjssla,项目名称:jejufoodwinefestival,代码行数:8,代码来源:wc-template-function.php


示例4: spyropress_wc_shop_header

/** Add Shop Header */
function spyropress_wc_shop_header()
{
    if (is_single()) {
        return;
    }
    wc_get_template_part('global/shop', 'header');
}
开发者ID:rinodung,项目名称:myfreetheme,代码行数:8,代码来源:woocommerce-init.php


示例5: content

    protected function content($atts, $content = null)
    {
        $atts = function_exists('vc_map_get_attributes') ? vc_map_get_attributes('lastest_deals_sidebar', $atts) : $atts;
        $atts = shortcode_atts(array('title' => '', 'taxonomy' => '', 'number' => 12, 'autoplay' => "false", 'navigation' => "false", 'slidespeed' => 250, 'loop' => "false", 'items' => 1, 'css_animation' => '', 'el_class' => '', 'css' => ''), $atts);
        extract($atts);
        $elementClass = array('base' => apply_filters(VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, 'latest-deals ', $this->settings['base'], $atts), 'extra' => $this->getExtraClass($el_class), 'css_animation' => $this->getCSSAnimation($css_animation), 'shortcode_custom' => vc_shortcode_custom_css_class($css, ' '));
        $elementClass = preg_replace(array('/\\s+/', '/^\\s|\\s$/'), array(' ', ''), implode(' ', $elementClass));
        $elementClass = apply_filters('kt_lastest_deals_sidebar_class_container', $elementClass);
        // Get products on sale
        $product_ids_on_sale = wc_get_product_ids_on_sale();
        $meta_query = WC()->query->get_meta_query();
        $args = array('posts_per_page' => $number, 'post_type' => 'product', 'orderby' => 'meta_value_num', 'meta_key' => '_sale_price_dates_to', 'order' => 'DESC', 'no_found_rows' => 1, 'post_status' => 'publish', 'meta_query' => $meta_query, 'post__in' => array_merge(array(0), $product_ids_on_sale));
        if ($taxonomy) {
            $args['tax_query'] = array(array('taxonomy' => 'product_cat', 'field' => 'id', 'terms' => explode(",", $taxonomy)));
        }
        $q = apply_filters('woocommerce_shortcode_products_query', $args, $atts);
        $query = new WP_Query($q);
        global $woocommerce_loop;
        ob_start();
        if ($query->have_posts()) {
            $data_carousel = array("autoplay" => $autoplay, "navigation" => $navigation, "slidespeed" => $slidespeed, "autoheight" => "false", "loop" => $loop, "dots" => "false", 'nav' => "true", "autoplayTimeout" => 1000, "autoplayHoverPause" => "true", 'items' => 1);
            add_filter("woocommerce_get_price_html_from_to", "kt_get_price_html_from_to", 10, 4);
            add_filter('woocommerce_sale_price_html', 'woocommerce_custom_sales_price', 10, 2);
            ?>
            <div class="<?php 
            echo esc_attr($elementClass);
            ?>
">
                <h2 class="latest-deal-title"><?php 
            echo esc_html($title);
            ?>
</h2>
                <div class="latest-deal-content">
                    <ul class="product-list owl-carousel" <?php 
            echo _data_carousel($data_carousel);
            ?>
>
                        <?php 
            add_filter("woocommerce_get_price_html_from_to", "kt_get_price_html_from_to", 10, 4);
            while ($query->have_posts()) {
                $query->the_post();
                wc_get_template_part('content', 'product-sidebar');
            }
            // end of the loop.
            remove_filter("woocommerce_get_price_html_from_to", "kt_get_price_html_from_to", 10, 4);
            ?>
                    </ul>
                </div>
            </div>
            <?php 
            remove_filter("woocommerce_get_price_html_from_to", "kt_get_price_html_from_to", 10, 4);
            remove_filter('woocommerce_sale_price_html', 'woocommerce_custom_sales_price', 10, 2);
        }
        wp_reset_postdata();
        wp_reset_query();
        $result = ob_get_contents();
        ob_clean();
        return $result;
    }
开发者ID:hikaram,项目名称:wee,代码行数:59,代码来源:lastest_deals_sidebar.php


示例6: content

    protected function content($atts, $content = null)
    {
        $atts = function_exists('vc_map_get_attributes') ? vc_map_get_attributes('list_product', $atts) : $atts;
        $atts = shortcode_atts(array('title' => '', 'cat' => 0, 'number' => 4, 'types' => 'sale', 'css_animation' => '', 'el_class' => '', 'css' => ''), $atts);
        extract($atts);
        global $woocommerce_loop;
        $elementClass = array('base' => apply_filters(VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, 'popular-tabs ', $this->settings['base'], $atts), 'extra' => $this->getExtraClass($el_class), 'css_animation' => $this->getCSSAnimation($css_animation), 'shortcode_custom' => vc_shortcode_custom_css_class($css, ' '));
        $elementClass = preg_replace(array('/\\s+/', '/^\\s|\\s$/'), array(' ', ''), implode(' ', $elementClass));
        ob_start();
        $meta_query = WC()->query->get_meta_query();
        $query = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $number, 'meta_query' => $meta_query);
        global $woocommerce_loop;
        $woocommerce_loop['columns'] = $number;
        if ($cat > 0) {
            $query['tax_query'] = array(array('taxonomy' => 'product_cat', 'field' => 'id', 'terms' => $cat));
        }
        if ($types == 'arrival') {
            $query['orderby'] = 'date';
            $query['order'] = 'DESC';
        }
        if ($types == 'sale') {
            $product_ids_on_sale = wc_get_product_ids_on_sale();
            $query['meta_key'] = 'total_sales';
            $query['orderby'] = 'meta_value_num';
            $query['post__in'] = array_merge(array(0), $product_ids_on_sale);
        }
        if ($types == 'review') {
            add_filter('posts_clauses', array($this, 'order_by_rating_post_clauses'));
        }
        $products = new WP_Query(apply_filters('woocommerce_shortcode_products_query', $query, $atts));
        if ($types == 'review') {
            remove_filter('posts_clauses', array($this, 'order_by_rating_post_clauses'));
        }
        if ($products->have_posts()) {
            ?>
        <div class="mega-group">
            <h4 class="mega-group-header"><span><?php 
            echo esc_html($title);
            ?>
</span></h4>
            <div class="mega-products">
                <?php 
            while ($products->have_posts()) {
                $products->the_post();
                ?>
                    <?php 
                wc_get_template_part('content', 'product-verticalmenu');
                ?>
                <?php 
            }
            // end of the loop.
            ?>
            </div>
        </div>  
        <?php 
        }
        return ob_get_clean();
    }
开发者ID:hikaram,项目名称:wee,代码行数:58,代码来源:list_product.php


示例7: 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


示例8: widget

    public function widget($args, $instance)
    {
        echo apply_filters('kt_wg_before_widget', $args['before_widget']);
        $title = isset($instance['title']) && $instance['title'] ? esc_html($instance['title']) : '';
        $orderby = isset($instance['orderby']) && $instance['orderby'] ? esc_attr($instance['orderby']) : 'date';
        $order = isset($instance['order']) && $instance['order'] ? esc_attr($instance['order']) : 'desc';
        $posts_per_page = isset($instance['posts_per_page']) && $instance['posts_per_page'] ? intval($instance['posts_per_page']) : '3';
        $meta_query = WC()->query->get_meta_query();
        $params = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $posts_per_page, 'meta_query' => $meta_query, 'suppress_filter' => true, 'orderby' => $orderby, 'order' => $order);
        if ($title) {
            echo apply_filters('kt_wg_before_title', $args['before_title']);
            echo esc_html($title);
            echo apply_filters('kt_wg_after_title', $args['after_title']);
        }
        $product = new WP_Query($params);
        ?>
        <!-- SPECIAL -->
        <div class="block left-module">
            <div class="block_content">
                <ul class="products-block">
                    <?php 
        if ($product->have_posts()) {
            ?>
                            <?php 
            while ($product->have_posts()) {
                $product->the_post();
                ?>
                                <?php 
                wc_get_template_part('content', 'special-product-sidebar');
                ?>
                            <?php 
            }
            ?>
                    <?php 
        }
        wp_reset_query();
        wp_reset_postdata();
        $shop_page_url = get_permalink(woocommerce_get_page_id('shop'));
        ?>
                </ul>
                <div class="products-block">
                    <div class="products-block-bottom">
                        <a class="link-all" href="<?php 
        echo esc_url($shop_page_url);
        ?>
"><?php 
        esc_html_e('All Products', 'kutetheme');
        ?>
</a>
                    </div>
                </div>
            </div>                            
        </div>
        <!-- ./SPECIAL -->
        <?php 
        echo apply_filters('kt_wg_after_widget', $args['after_widget']);
    }
开发者ID:hikaram,项目名称:wee,代码行数:57,代码来源:product-special-sidebar.php


示例9: 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


示例10: element

 /**
  * This method is used to display the output of the element.
  * @return void
  */
 function element()
 {
     // Prevent the elemnt from being accessible on other pages
     if (!is_singular('product')) {
         echo '<div class="zn-pb-notification">This element only works on single product pages created with WooCommerce. Please delete it.</div>';
         return false;
     }
     echo '<div class="zn_post_content_elemenent ' . $this->data['uid'] . ' ' . $this->opt('css_class', '') . '">';
     wc_get_template_part('content', 'single-product');
     echo '</div>';
 }
开发者ID:rock1media,项目名称:wordpress,代码行数:15,代码来源:TH_ProductContent.php


示例11: widget

 public function widget($args, $instance)
 {
     echo apply_filters('kt_wg_before_widget', $args['before_widget']);
     $title = isset($instance['title']) && $instance['title'] ? esc_html($instance['title']) : '';
     $number = isset($instance['number']) && intval($instance['number']) ? intval($instance['number']) : 3;
     $orderby = isset($instance['orderby']) && $instance['orderby'] ? esc_attr($instance['orderby']) : 'date';
     $order = isset($instance['order']) && $instance['order'] ? esc_attr($instance['order']) : 'desc';
     $meta_query = WC()->query->get_meta_query();
     $product_ids_on_sale = wc_get_product_ids_on_sale();
     $params = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $number, 'meta_query' => $meta_query, 'suppress_filter' => true, 'orderby' => $orderby, 'order' => $order, 'post__in' => array_merge(array(0), $product_ids_on_sale));
     $product = new WP_Query($params);
     if ($product->have_posts()) {
         ?>
     <!-- block best sellers -->
     <div class="block left-module">
         <?php 
         if ($title) {
             echo apply_filters('kt_wg_before_title', $args['before_title']);
             echo esc_html($title);
             echo apply_filters('kt_wg_after_title', $args['after_title']);
         }
         add_filter('woocommerce_sale_price_html', 'woocommerce_custom_sales_price', 10, 2);
         add_filter("woocommerce_get_price_html_from_to", "kt_get_price_html_from_to", 10, 4);
         ?>
         <div class="block_content product-onsale">
             <ul class="product-list owl-carousel" data-loop="false" data-nav = "false" data-margin = "0" data-autoplayTimeout="1000" data-autoplayHoverPause = "true" data-items="1" data-autoplay="false">
                 <?php 
         while ($product->have_posts()) {
             $product->the_post();
             ?>
                     <li>
                         <?php 
             wc_get_template_part('content', 'on-sale-sidebar');
             ?>
                     </li>
                 <?php 
         }
         ?>
             </ul>
         </div>
         <?php 
         remove_filter("woocommerce_get_price_html_from_to", "kt_get_price_html_from_to", 10, 4);
         remove_filter('woocommerce_sale_price_html', 'woocommerce_custom_sales_price', 10, 2);
         ?>
     </div>
     <!-- ./block best sellers  -->
     <?php 
     }
     echo apply_filters('kt_wg_after_widget', $args['after_widget']);
 }
开发者ID:k2jysy,项目名称:kshop,代码行数:50,代码来源:on-sale.php


示例12: filter_wc_template_rendering

 /**
  * Filter that replaces current woocommerce template with template defined in settings.
  *
  * @see beforeWCTemplateRender
  * @param  string $file full path to currently rendered template
  * @return mixed
  */
 public static function filter_wc_template_rendering($file)
 {
     if ($file && self::isTourProduct()) {
         $anotherTemplate = '';
         $map = self::$wcTemplatesMap;
         $baseName = basename($file, '.php');
         if (isset($map[$baseName])) {
             wc_get_template_part($map[$baseName]);
             // get_template_part($map[$baseName]);
             return false;
         }
     }
     return $file;
 }
开发者ID:j-kenneth,项目名称:Expeero,代码行数:21,代码来源:AtTourHelper.php


示例13: nm_ajax_load_product

function nm_ajax_load_product()
{
    global $woocommerce, $product, $post;
    //$post = $product = get_post( $_POST['product_id'] );
    $product = get_product($_POST['product_id']);
    $post = $product->post;
    $output = '';
    setup_postdata($post);
    ob_start();
    wc_get_template_part('quickview/content', 'quickview');
    $output = ob_get_clean();
    wp_reset_postdata();
    echo $output;
    exit;
}
开发者ID:kevinotsuka,项目名称:coffeecircle,代码行数:15,代码来源:quickview.php


示例14: pgl_woocommerce_switch_layout_ajax

function pgl_woocommerce_switch_layout_ajax()
{
    $args = json_decode(base64_decode($_POST['query']));
    $type = $_POST['type'];
    $query = new WP_Query($args);
    query_posts($args);
    while ($query->have_posts()) {
        $query->the_post();
        if ($type == 'list') {
            wc_get_template_part('content', 'product-list');
        } else {
            wc_get_template_part('content', 'product');
        }
    }
    die;
}
开发者ID:devmoonshine,项目名称:development,代码行数:16,代码来源:woocommerce.php


示例15: 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


示例16: frar_display_products

function frar_display_products()
{
    $ul = '<ul id="list" class="products">';
    $args = array('post_type' => 'product', 'posts_per_page' => 2);
    $loop = new WP_Query($args);
    if ($loop->have_posts()) {
        while ($loop->have_posts()) {
            $loop->the_post();
            // var_dump($loop->the_post());
            wc_get_template_part('content', 'product');
        }
    } else {
        echo __('No products found');
    }
    wp_reset_postdata();
    $ul .= '</ul>';
    return $ul;
}
开发者ID:epiii,项目名称:aros,代码行数:18,代码来源:frar.php


示例17: widget

    public function widget($args, $instance)
    {
        echo $args['before_widget'];
        $title = isset($instance['title']) ? esc_attr($instance['title']) : '';
        $orderby = isset($instance['orderby']) ? $instance['orderby'] : 'date';
        $order = isset($instance['order']) ? $instance['order'] : 'desc';
        $meta_query = WC()->query->get_meta_query();
        $params = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => 1, 'meta_query' => $meta_query, 'suppress_filter' => true, 'orderby' => $orderby, 'order' => $order);
        $product = new WP_Query($params);
        ?>
        <!-- SPECIAL -->
        <div class="block left-module">
            <p class="title_block"><?php 
        echo $title;
        ?>
</p>
            <?php 
        if ($product->have_posts()) {
            ?>
                <?php 
            while ($product->have_posts()) {
                $product->the_post();
                ?>
                    <?php 
                wc_get_template_part('content', 'special-product-sidebar');
                ?>
                <?php 
            }
            ?>
            <?php 
        }
        wp_reset_query();
        wp_reset_postdata();
        ?>
        </div>
        <!-- ./SPECIAL -->
        <?php 
        echo $args['after_widget'];
    }
开发者ID:ngocthangict,项目名称:kutetheme-wp,代码行数:39,代码来源:product-special-sidebar.php


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


示例19: _e

            <h4><?php 
        _e('Complete the look', 'captiva');
        ?>
</h4>
    <?php 
    }
    ?>

        <ul class="up-sell-grid"> 

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

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

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

        </ul>

    </div>

<?php 
}
wp_reset_postdata();
开发者ID:cimocimocimo,项目名称:staydrysystems.com,代码行数:31,代码来源:up-sells.php


示例20: wc_get_template_part

<?php

/**
 * Checkout Form
 *
 * @author 		WooThemes
 * @package 	WooCommerce/Templates
 * @version     2.0.0
 */
if (!defined('ABSPATH')) {
    exit;
}
// Exit if accessed directly
echo '<hr class="tall" />';
wc_get_template_part('checkout/header');
wc_print_notices();
do_action('woocommerce_before_checkout_form', $checkout);
// If checkout registration is disabled and not logged in, the user cannot checkout
if (!$checkout->enable_signup && !$checkout->enable_guest_checkout && !is_user_logged_in()) {
    echo apply_filters('woocommerce_checkout_must_be_logged_in_message', __('You must be logged in to checkout.', 'woocommerce'));
    return;
}
// filter hook for include new pages inside the payment method
$get_checkout_url = apply_filters('woocommerce_get_checkout_url', WC()->cart->get_checkout_url());
?>


<div class="row">
    <div class="col-md-9">
        <form name="checkout" method="post" class="checkout" action="<?php 
echo esc_url($get_checkout_url);
开发者ID:rinodung,项目名称:myfreetheme,代码行数:31,代码来源:form-checkout.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP wc_get_text_attributes函数代码示例发布时间:2022-05-23
下一篇:
PHP wc_get_template_html函数代码示例发布时间: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