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


PHP woocommerce_products_will_display函数代码示例

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


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

示例1: woocommerce_catalog_ordering

    /**
     * Output the product sorting options.
     *
     * @access public
     * @subpackage	Loop
     * @return void
     */
    function woocommerce_catalog_ordering()
    {
        global $woocommerce;
        $orderby = isset($_GET['orderby']) ? woocommerce_clean($_GET['orderby']) : apply_filters('woocommerce_default_catalog_orderby', get_option('woocommerce_default_catalog_orderby'));
        /**
         * Show options for ordering
         *
         * @author 		WooThemes
         * @package 	WooCommerce/Templates
         * @version     2.0.0
         */
        if (!defined('ABSPATH')) {
            exit;
        }
        // Exit if accessed directly
        global $woocommerce, $wp_query;
        if (1 == $wp_query->found_posts || !woocommerce_products_will_display()) {
            return;
        }
        ?>
        <form class="woocommerce-ordering" method="get">
            <div class="woocommerce-ordering-div">
            	<select name="orderby" class="orderby">
            		<?php 
        $catalog_orderby = apply_filters('woocommerce_catalog_orderby', array('menu_order' => __('Default sorting', 'woocommerce'), 'popularity' => __('Sort by popularity', 'woocommerce'), 'rating' => __('Sort by average rating', 'woocommerce'), 'date' => __('Sort by newness', 'woocommerce'), 'price' => __('Sort by price: low to high', 'woocommerce'), 'price-desc' => __('Sort by price: high to low', 'woocommerce')));
        if (get_option('woocommerce_enable_review_rating') == 'no') {
            unset($catalog_orderby['rating']);
        }
        foreach ($catalog_orderby as $id => $name) {
            echo '<option value="' . esc_attr($id) . '" ' . selected($orderby, $id, false) . '>' . esc_attr($name) . '</option>';
        }
        ?>
            	</select>
        	</div>
        	<?php 
        // Keep query string vars intact
        foreach ($_GET as $key => $val) {
            if ('orderby' == $key) {
                continue;
            }
            if (is_array($val)) {
                foreach ($val as $innerVal) {
                    echo '<input type="hidden" name="' . esc_attr($key) . '[]" value="' . esc_attr($innerVal) . '" />';
                }
            } else {
                echo '<input type="hidden" name="' . esc_attr($key) . '" value="' . esc_attr($val) . '" />';
            }
        }
        ?>
        </form>

<?php 
    }
开发者ID:nikolaskarica,项目名称:bds-alliance,代码行数:60,代码来源:gumm_woocommerce_functions.php

示例2: widget

 /**
  * Widget function
  *
  * @see WP_Widget
  * @access public
  * @param array $args
  * @param array $instance
  * @return void
  */
 public function widget($args, $instance)
 {
     global $wp_query;
     extract($args);
     $title = !empty($instance['title']) ? $before_title . $instance['title'] . $after_title : '';
     $output = '';
     if (1 != $wp_query->found_posts || woocommerce_products_will_display()) {
         $output .= '<ul id="nm-product-sorting" class="nm-product-sorting">';
         $orderby = isset($_GET['orderby']) ? wc_clean($_GET['orderby']) : apply_filters('woocommerce_default_catalog_orderby', get_option('woocommerce_default_catalog_orderby'));
         $orderby == ($orderby === 'title') ? 'menu_order' : $orderby;
         // Fixed: 'title' is default before WooCommerce settings are saved
         $catalog_orderby_options = apply_filters('woocommerce_catalog_orderby', array('menu_order' => __('Default', 'nm-framework'), 'popularity' => __('Popularity', 'nm-framework'), 'rating' => __('Average rating', 'nm-framework'), 'date' => __('Newness', 'nm-framework'), 'price' => __('Price: Low to High', 'nm-framework'), 'price-desc' => __('Price: High to Low', 'nm-framework')));
         if (get_option('woocommerce_enable_review_rating') === 'no') {
             unset($catalog_orderby_options['rating']);
         }
         /* Build entire current page URL (including query strings) */
         global $wp;
         $link = home_url($wp->request);
         // Base page URL
         // Unset query strings used for Ajax shop filters
         unset($_GET['shop_load']);
         unset($_GET['_']);
         $qs_count = count($_GET);
         // Any query strings to add?
         if ($qs_count > 0) {
             $i = 0;
             $link .= '?';
             // Build query string
             foreach ($_GET as $key => $value) {
                 $i++;
                 $link .= $key . '=' . $value;
                 if ($i != $qs_count) {
                     $link .= '&';
                 }
             }
         }
         foreach ($catalog_orderby_options as $id => $name) {
             if ($orderby == $id) {
                 $output .= '<li class="active">' . esc_attr($name) . '</li>';
             } else {
                 // Add 'orderby' URL query string
                 $link = add_query_arg('orderby', $id, $link);
                 $output .= '<li><a href="' . esc_url($link) . '">' . esc_attr($name) . '</a></li>';
             }
         }
         $output .= '</ul>';
     }
     echo $before_widget . $title . $output . $after_widget;
 }
开发者ID:kevinotsuka,项目名称:coffeecircle,代码行数:58,代码来源:woocommerce-product-sorting.php

示例3: heni_catalog_ordering

/**
 * Output the product sorting options.
 *
 * @subpackage	Loop
 */
function heni_catalog_ordering()
{
    global $wp_query;
    if (1 == $wp_query->found_posts || !woocommerce_products_will_display()) {
        return;
    }
    $orderby = isset($_GET['orderby']) ? wc_clean($_GET['orderby']) : apply_filters('woocommerce_default_catalog_orderby', get_option('woocommerce_default_catalog_orderby'));
    $show_default_orderby = 'menu_order' === apply_filters('woocommerce_default_catalog_orderby', get_option('woocommerce_default_catalog_orderby'));
    $catalog_orderby_options = apply_filters('woocommerce_catalog_orderby', array('menu_order' => __('Default sorting', 'woocommerce')));
    if (!$show_default_orderby) {
        unset($catalog_orderby_options['menu_order']);
    }
    if (get_option('woocommerce_enable_review_rating') === 'no') {
        unset($catalog_orderby_options['rating']);
    }
    wc_get_template('loop/orderby.php', array('catalog_orderby_options' => $catalog_orderby_options, 'orderby' => $orderby, 'show_default_orderby' => $show_default_orderby));
}
开发者ID:nicolas-thompson,项目名称:heni,代码行数:22,代码来源:functions.php

示例4: hwoo_archive_result_count

 /**
  * products result count in archive page
  */
 function hwoo_archive_result_count()
 {
     $data = utility_data(func_get_args());
     global $wp_query;
     if (!woocommerce_products_will_display()) {
         return;
     }
     $paged = max(1, $wp_query->get('paged'));
     $per_page = $wp_query->get('posts_per_page');
     $total = $wp_query->found_posts;
     $first = $per_page * $paged - $per_page + 1;
     $last = min($total, $wp_query->get('posts_per_page') * $paged);
     $context = HW_Timber::load($data['current_working_template']);
     $context['total'] = $total;
     $context['first'] = $first;
     $context['last'] = $last;
     $context['show_all'] = $total <= $per_page || -1 == $per_page;
     HW_Timber::_render(array('woo/loop/result-count.twig'), $context);
 }
开发者ID:hoangsoft90,项目名称:hw-hoangweb-plugin,代码行数:22,代码来源:template-functions.php

示例5: widget

 public function widget($args, $instance)
 {
     global $wp_query;
     if (1 === $wp_query->found_posts || !woocommerce_products_will_display()) {
         return;
     }
     $this->widget_start($args, $instance);
     $orderby = isset($_GET['orderby']) ? wc_clean($_GET['orderby']) : apply_filters('woocommerce_default_catalog_orderby', get_option('woocommerce_default_catalog_orderby'));
     $show_default_orderby = 'menu_order' === apply_filters('woocommerce_default_catalog_orderby', get_option('woocommerce_default_catalog_orderby'));
     $catalog_orderby_options = apply_filters('woocommerce_catalog_orderby', array('menu_order' => esc_html__('Default sorting', 'woocommerce'), 'popularity' => esc_html__('Sort by popularity', 'woocommerce'), 'rating' => esc_html__('Sort by average rating', 'woocommerce'), 'date' => esc_html__('Sort by newness', 'woocommerce'), 'price' => esc_html__('Sort by price: low to high', 'woocommerce'), 'price-desc' => esc_html__('Sort by price: high to low', 'woocommerce')));
     if (!$show_default_orderby) {
         unset($catalog_orderby_options['menu_order']);
     }
     if ('no' === get_option('woocommerce_enable_review_rating')) {
         unset($catalog_orderby_options['rating']);
     }
     global $wp;
     $link = home_url($wp->request);
     // Base page URL
     if (isset($_SERVER['QUERY_STRING'])) {
         parse_str($_SERVER['QUERY_STRING'], $params);
         $link .= '?' . $_SERVER['QUERY_STRING'];
     } else {
         $link .= '';
     }
     $output = '';
     foreach ($catalog_orderby_options as $id => $name) {
         $link_url = add_query_arg(array('orderby' => $id), $link);
         if ($orderby == $id) {
             $output .= '<li class="selected">' . esc_html($name) . '</li>';
         } else {
             $output .= '<li><a href="' . esc_url($link_url) . '">' . esc_html($name) . '</a></li>';
         }
     }
     printf('<ul>%s</ul>', $output);
     $this->widget_end($args);
 }
开发者ID:websideas,项目名称:Mondova,代码行数:37,代码来源:orderby.php

示例6: array

<?php

/**
 * Show options for ordering
 *
 * @author 		WooThemes
 * @package 	WooCommerce/Templates
 * @version     2.2.0
 */
if (!defined('ABSPATH')) {
    exit;
}
// Exit if accessed directly
global $woocommerce, $wp_query;
if (1 == $wp_query->found_posts || !woocommerce_products_will_display()) {
    return;
}
?>
<form class="woocommerce-ordering" method="get">
	<select name="orderby" class="orderby pm-orderby-filter">
		<?php 
$catalog_orderby = apply_filters('woocommerce_catalog_orderby', array('menu_order' => __('Default sorting', 'woocommerce'), 'popularity' => __('Sort by popularity', 'woocommerce'), 'rating' => __('Sort by average rating', 'woocommerce'), 'date' => __('Sort by newness', 'woocommerce'), 'price' => __('Sort by price: low to high', 'woocommerce'), 'price-desc' => __('Sort by price: high to low', 'woocommerce')));
if (get_option('woocommerce_enable_review_rating') === 'no') {
    unset($catalog_orderby['rating']);
}
foreach ($catalog_orderby as $id => $name) {
    echo '<option value="' . esc_attr($id) . '" ' . selected($orderby, $id, false) . '>' . esc_attr($name) . '</option>';
}
?>
	</select>
	<?php 
开发者ID:virendrayadav,项目名称:vinayakabags,代码行数:31,代码来源:orderby.php

示例7: storefront_woocommerce_pagination

 function storefront_woocommerce_pagination()
 {
     if (woocommerce_products_will_display()) {
         woocommerce_pagination();
     }
 }
开发者ID:karyband,项目名称:Rettner-Website,代码行数:6,代码来源:template-tagsnew.php

示例8: wc_get_template_part

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

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

                <?php 
    woocommerce_product_loop_end();
    ?>

            </div>

            <div class="shop-loop-after clearfix"<?php 
    if (!is_search() && !woocommerce_products_will_display()) {
        echo ' style="display:none;"';
    }
    ?>
>
			<?php 
    /**
     * woocommerce_after_shop_loop hook.
     *
     * @hooked woocommerce_pagination - 10
     */
    do_action('woocommerce_after_shop_loop');
    ?>
            </div>

        <?php 
开发者ID:booklein,项目名称:wpbookle,代码行数:31,代码来源:archive-product.php

示例9: woocommerce_product_query

 /**
  * Posts per page.
  *
  * Set the number of posts per page on a hard way, build in fix for many themes who override the offical loop_shop_per_page filter.
  *
  * @since 1.2.0
  *
  * @param	object 	$q		Existing query object.
  * @param	object	$class	Class object.
  * @return 	object 			Modified query object.
  */
 public function woocommerce_product_query($q, $class)
 {
     if (function_exists('woocommerce_products_will_display') && woocommerce_products_will_display() && $q->is_main_query()) {
         $q->set('posts_per_page', $this->loop_shop_per_page());
     }
 }
开发者ID:gelther,项目名称:wppp,代码行数:17,代码来源:class-wppp-front-end.php

示例10: eighteen_tags_woocommerce_pagination

 function eighteen_tags_woocommerce_pagination()
 {
     if (woocommerce_products_will_display()) {
         woocommerce_pagination();
     }
 }
开发者ID:pootlepress,项目名称:18-tags,代码行数:6,代码来源:template-tags.php

示例11: mango_woocommerce_after_shop_loop

function mango_woocommerce_after_shop_loop()
{
    ?>
   <?php 
    if (!woocommerce_products_will_display()) {
        return;
    }
    ?>
    <nav class="pagination-container">
        <?php 
    woocommerce_result_count();
    ?>
        <nav class="woocommerce-pagination">
            <?php 
    woocommerce_pagination();
    ?>
        </nav>
    </nav>
<?php 
}
开发者ID:nickkoskowski,项目名称:Work-Depot,代码行数:20,代码来源:woocommerce.php

示例12: shop_isle_woocommerce_pagination

 function shop_isle_woocommerce_pagination()
 {
     if (woocommerce_products_will_display()) {
         woocommerce_pagination();
     }
 }
开发者ID:sucun21,项目名称:Ginseng,代码行数:6,代码来源:template-tags.php

示例13: neckbeard_woocommerce_pagination

 function neckbeard_woocommerce_pagination()
 {
     if (woocommerce_products_will_display()) {
         woocommerce_pagination();
     }
 }
开发者ID:digitoimistodude,项目名称:neckbeard,代码行数:6,代码来源:template-tags.php

示例14: woocommerce_catalog_ordering

 /**
  * Output the product sorting options.
  *
  * @access public
  * @subpackage	Loop
  * @return void
  */
 function woocommerce_catalog_ordering()
 {
     global $wp_query;
     if (1 == $wp_query->found_posts || !woocommerce_products_will_display()) {
         return;
     }
     $orderby = isset($_GET['orderby']) ? wc_clean($_GET['orderby']) : apply_filters('woocommerce_default_catalog_orderby', get_option('woocommerce_default_catalog_orderby'));
     $show_default_orderby = 'menu_order' === apply_filters('woocommerce_default_catalog_orderby', get_option('woocommerce_default_catalog_orderby'));
     $catalog_orderby_options = apply_filters('woocommerce_catalog_orderby', array('menu_order' => __('Default sorting', 'woocommerce'), 'popularity' => __('Sort by popularity', 'woocommerce'), 'rating' => __('Sort by average rating', 'woocommerce'), 'date' => __('Sort by newness', 'woocommerce'), 'price' => __('Sort by price: low to high', 'woocommerce'), 'price-desc' => __('Sort by price: high to low', 'woocommerce')));
     if (!$show_default_orderby) {
         unset($catalog_orderby_options['menu_order']);
     }
     if (get_option('woocommerce_enable_review_rating') === 'no') {
         unset($catalog_orderby_options['rating']);
     }
     wc_get_template('loop/orderby.php', array('catalog_orderby_options' => $catalog_orderby_options, 'orderby' => $orderby, 'show_default_orderby' => $show_default_orderby));
 }
开发者ID:uwitec,项目名称:findgreatmaster,代码行数:24,代码来源:wc-template-functions.php

示例15: pierry_breadcrumb_display

function pierry_breadcrumb_display()
{
    if (!apply_filters('tc_show_breadcrumb', 1 == esc_attr(TC_utils::$inst->tc_opt('tc_breadcrumb')))) {
        return;
    }
    if (!apply_filters('tc_show_breadcrumb_in_context', true)) {
        return;
    }
    if (tc__f('__is_home') && 1 != esc_attr(TC_utils::$inst->tc_opt('tc_show_breadcrumb_home'))) {
        return;
    }
    if (is_cart() || is_checkout()) {
        echo pierry_breadcrumb_for_cart_checkout();
        return;
    }
    //-----set the args properties-------
    $args = array('container' => 'div', 'separator' => '/', 'before' => false, 'after' => false, 'front_page' => true, 'show_home' => __('Home', 'customizr'), 'network' => false, 'echo' => false);
    /* Set up the default arguments for the breadcrumb. */
    $defaults = array('container' => 'div', 'separator' => '&raquo;', 'before' => __('Browse:', 'customizr'), 'after' => false, 'front_page' => true, 'show_home' => __('Home', 'customizr'), 'network' => false, 'echo' => true);
    /* Allow singular post views to have a taxonomy's terms prefixing the trail. */
    if (is_singular()) {
        $post = get_queried_object();
        $defaults["singular_breadcrumb_taxonomy"] = apply_filters('tc_display_taxonomies_in_breadcrumb', true, $post->post_type);
    }
    /* Parse the arguments and extract them for easy variable naming. */
    $args = apply_filters('tc_breadcrumb_trail_args', wp_parse_args($args, $defaults), $args, $defaults);
    //----- end set the args properties-------
    global $wp_query;
    if (1 == $wp_query->found_posts || !woocommerce_products_will_display()) {
        $orderby = $show_default_orderby = '';
        $catalog_orderby_options = array();
        //return;
    } else {
        $orderby = isset($_GET['orderby']) ? wc_clean($_GET['orderby']) : apply_filters('woocommerce_default_catalog_orderby', get_option('woocommerce_default_catalog_orderby'));
        $show_default_orderby = 'menu_order' === apply_filters('woocommerce_default_catalog_orderby', get_option('woocommerce_default_catalog_orderby'));
        $catalog_orderby_options = apply_filters('woocommerce_catalog_orderby', array('menu_order' => __('Sort by:', 'woocommerce'), 'popularity' => __('Sort by popularity', 'woocommerce'), 'rating' => __('Sort by average rating', 'woocommerce'), 'date' => __('Sort by newness', 'woocommerce'), 'price' => __('Sort by price: low to high', 'woocommerce'), 'price-desc' => __('Sort by price: high to low', 'woocommerce')));
        if (!$show_default_orderby) {
            unset($catalog_orderby_options['menu_order']);
        }
        if (get_option('woocommerce_enable_review_rating') === 'no') {
            unset($catalog_orderby_options['rating']);
        }
    }
    wc_get_template('breadcrumbs-product-orderby.php', array('catalog_orderby_options' => $catalog_orderby_options, 'orderby' => $orderby, 'show_default_orderby' => $show_default_orderby, 'args' => TC_breadcrumb::$instance->tc_breadcrumb_trail($args)));
}
开发者ID:samiksha369,项目名称:majorcraft,代码行数:45,代码来源:functions.php


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