本文整理汇总了PHP中woocommerce_catalog_ordering函数的典型用法代码示例。如果您正苦于以下问题:PHP woocommerce_catalog_ordering函数的具体用法?PHP woocommerce_catalog_ordering怎么用?PHP woocommerce_catalog_ordering使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了woocommerce_catalog_ordering函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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)
{
echo $args['before_widget'];
?>
<?php
echo $args['before_title'] . apply_filters('widget_title', $instance['title']) . $args['after_title'];
?>
<?php
woocommerce_catalog_ordering();
?>
<?php
echo $args['after_widget'];
}
示例2: yit_wc_catalog_ordering
function yit_wc_catalog_ordering()
{
if (!is_single() && have_posts()) {
woocommerce_catalog_ordering();
}
}
示例3: avia_woocommerce_advanced_title
function avia_woocommerce_advanced_title()
{
global $wp_query;
$titleClass = "";
$image = "";
if (isset($wp_query->query_vars['taxonomy'])) {
$term = get_term_by('slug', get_query_var($wp_query->query_vars['taxonomy']), $wp_query->query_vars['taxonomy']);
$attachment_id = get_woocommerce_term_meta($term->term_id, 'thumbnail_id');
if (!empty($term->description)) {
$titleClass .= "title_container_description ";
}
}
if (!empty($attachment_id)) {
$titleClass .= "title_container_image ";
$image = wp_get_attachment_image($attachment_id, 'thumbnail', false, array('class' => 'category_thumb'));
}
echo "<div class='title_container {$titleClass}'>";
echo avia_breadcrumbs();
woocommerce_catalog_ordering();
echo $image;
}
示例4: shop_tool_bar
/**
* Display a tool bar on top of product archive
*
* @since 1.0
*/
function shop_tool_bar()
{
$numbers = array(9, 12, 15, 18, 21);
if ($this->layout == 'full-content') {
$numbers = array(8, 12, 16, 20, 24);
}
/**
* Allow child theme/plugin to modify the numbers array
*
* @since 1.1
*/
$number = apply_filters('bigboom_shop_product_numbers', $numbers, $this->layout);
$options = array();
$showposts = get_query_var('posts_per_page');
foreach ($numbers as $number) {
$options[] = sprintf('<option value="%s" %s>%s %s</option>', esc_attr($number), selected($number, $showposts, false), $number, __('items', 'bigboom'));
}
?>
<div class="shop-toolbar">
<div class="sorter clearfix">
<div class="shop-view col-xs-12 col-sm-4 hidden-xs hidden-sm">
<span><?php
_e('View as', 'bigboom');
?>
:</span>
<a href="#" class="grid-view <?php
echo $this->shop_view == 'grid' ? 'current' : '';
?>
" data-view="grid"><?php
_e('Grid', 'bigboom');
?>
</a> /
<a href="#" class="list-view <?php
echo $this->shop_view == 'list' ? 'current' : '';
?>
" data-view="list"><?php
_e('List', 'bigboom');
?>
</a>
</div>
<div class="sort-by col-xs-12 col-sm-4 hidden-xs hidden-sm">
<span><?php
_e('Sort by', 'bigboom');
?>
:</span>
<?php
woocommerce_catalog_ordering();
?>
</div>
<div class="limiter col-xs-12 col-sm-4 hidden-xs hidden-sm">
<form class="shop-products-number" method="get">
<span><?php
_e('Show', 'bigboom');
?>
:</span>
<select name="showposts">
<?php
echo implode('', $options);
?>
</select>
<?php
foreach ($_GET as $name => $value) {
if ('showposts' != $name) {
printf('<input type="hidden" name="%s" value="%s">', esc_attr($name), esc_attr($value));
}
}
?>
</form>
</div>
</div>
<div class="pager clearfix">
<?php
woocommerce_result_count();
?>
<?php
woocommerce_pagination();
?>
</div>
</div>
<?php
}
示例5: yiw_woocommerce_ordering
function yiw_woocommerce_ordering()
{
if (!is_single() && yiw_get_option('shop_show_woocommerce_ordering')) {
woocommerce_catalog_ordering();
}
}
示例6: cruxstore_woocommerce_shop_loop
function cruxstore_woocommerce_shop_loop()
{
$shop_header_tool_bar = cruxstore_option('shop_header_tool_bar', 1);
if ($shop_header_tool_bar) {
if ($shop_header_tool_bar == 2) {
echo '<div class="products-shop-header">';
cruxstore_category_menu();
echo '</div>';
} else {
echo '<div class="products-tools">';
woocommerce_result_count();
woocommerce_catalog_ordering();
cruxstore_woocommerce_gridlist_toggle();
echo '</div>';
}
}
}
示例7: mango_woocommerce_before_shop_loop
function mango_woocommerce_before_shop_loop()
{
global $mango_settings;
mango_taxonomy_banner();
?>
<div class="filter-row clearfix">
<?php
if (!woocommerce_products_will_display()) {
?>
</div> <?php
return;
}
?>
<?php
add_filter("woocommerce_catalog_orderby", function ($catalog_orderby_options) {
$catalog_orderby_options = array('menu_order' => __('Default Sorting', 'mango'), 'popularity' => __('Popularity', 'mango'), 'rating' => __('Average Rating', 'mango'), 'date' => __('Latest', 'mango'), 'price' => __('Lowest Price', 'mango'), 'price-desc' => __('Highest Price', 'mango'));
return $catalog_orderby_options;
});
woocommerce_catalog_ordering();
?>
<div class="filter-row-box second">
<form method="get">
<?php
if (isset($_GET) && !empty($_GET)) {
foreach ($_GET as $k => $v) {
if ($k != 'view') {
?>
<input type="hidden" name="<?php
echo esc_attr($k);
?>
"
value="<?php
echo esc_attr($v);
?>
"/>
<?php
}
}
}
?>
<button type="submit" name="view" value="grid"
class="btn <?php
echo mango_shop_view() == 'grid' ? 'active' : '';
?>
" title="Grid"><i
class="fa fa-th"></i></button>
<button type="submit" name="view" value="list"
class="btn <?php
echo mango_shop_view() == 'list' ? 'active' : '';
?>
" title="List"><i
class="fa fa-th-list"></i></button>
</form>
</div>
<!-- End .filter-row-box -->
<div class="clearfix visible-xs"></div>
<!-- End .clearfix -->
<div class="filter-row-box last">
<span class="filter-row-label"><?php
_e("Show", 'mango');
?>
</span>
<div class="small-selectbox quantity-selectbox clearfix">
<?php
$products_perpage = isset($mango_settings['mango_products_perpage']) && $mango_settings['mango_products_perpage'] ? $mango_settings['mango_products_perpage'] : '9,15,30';
$pr_p_ar = explode(",", $products_perpage);
if (isset($_GET['perpage']) && !in_array($_GET['perpage'])) {
$pr_p_ar[] = $_GET['perpage'];
}
$current = isset($_GET['perpage']) && $_GET['perpage'] ? $_GET['perpage'] : $pr_p_ar[0];
?>
<form method="get">
<?php
if (isset($_GET) && !empty($_GET)) {
foreach ($_GET as $k => $v) {
if ($k != 'perpage') {
?>
<input type="hidden" name="<?php
echo esc_attr($k);
?>
"
value="<?php
echo esc_attr($v);
?>
"/>
<?php
}
}
}
?>
<select id="number" name="perpage" class="selectbox" onchange="this.form.submit()">
<?php
foreach ($pr_p_ar as $number) {
?>
<option
value="<?php
echo esc_attr($number);
?>
" <?php
selected($number, $current);
//.........这里部分代码省略.........
示例8: woocommerce_result_count
?>
<div class="section_before_shop_loop clearfix">
<?php
if (!of_get_option('tokopress_wc_hide_result_count')) {
?>
<?php
woocommerce_result_count();
?>
<?php
}
?>
<?php
if (!of_get_option('tokopress_wc_hide_catalog_ordering')) {
?>
<?php
woocommerce_catalog_ordering();
?>
<?php
}
?>
</div>
<?php
}
?>
<?php
}
?>
<?php
woocommerce_product_loop_start();
?>
示例9: _render
protected function _render($options)
{
global $woocommerce;
$columns = (int) $this->getParam('postColumns');
$rowSpan = 12 / $columns;
$foundPosts = count($this->posts);
$rowClass = array('row-fluid', 'products');
if ($this->shouldPaginate) {
$rowClass[] = 'slides-container';
}
$counter = 1;
if ($this->getParam('layout') === 'grid' && $this->getParam('foundResultsDisplay') === 'true') {
woocommerce_result_count();
}
if ($this->getParam('layout') === 'grid' && $this->getParam('sortingDisplay') === 'true') {
woocommerce_catalog_ordering();
}
?>
<div class="<?php
echo implode(' ', $rowClass);
?>
">
<?php
while (have_posts()) {
the_post();
?>
<?php
$spanClass = array('span' . $rowSpan, 'gumm-filterable-item');
if ($this->shouldPaginate && $counter > $columns) {
$spanClass[] = 'hidden';
}
?>
<div <?php
post_class(implode(' ', $spanClass));
?>
>
<?php
do_action('woocommerce_before_shop_loop_item');
?>
<a href="<?php
the_permalink();
?>
">
<?php
/**
* woocommerce_before_shop_loop_item_title hook
*
* @hooked woocommerce_show_product_loop_sale_flash - 10
* @hooked woocommerce_template_loop_product_thumbnail - 10
*/
do_action('woocommerce_before_shop_loop_item_title');
?>
<h3><?php
the_title();
?>
</h3>
<?php
/**
* woocommerce_after_shop_loop_item_title hook
*
* @hooked woocommerce_template_loop_price - 10
*/
do_action('woocommerce_after_shop_loop_item_title');
?>
</a>
<?php
do_action('woocommerce_after_shop_loop_item');
?>
</div>
<?php
if ($counter % $columns === 0 && $counter < $foundPosts && $this->getParam('layout') === 'grid') {
echo '</div><div class="' . implode(' ', $rowClass) . '">';
}
$counter++;
?>
<?php
}
// end of the loop.
?>
</div>
<?php
do_action('gumm_woocommerce_print_pretty_photo_hidden_links');
}
示例10: shop_loop_info
/**
* Display shop loop results count and ordering.
*/
public function shop_loop_info()
{
echo '<div class="edu-shop-loop-info">';
woocommerce_catalog_ordering();
woocommerce_result_count();
echo '</div>';
}
示例11: hocwp_wc_filter_product_by_sort_type
function hocwp_wc_filter_product_by_sort_type()
{
woocommerce_catalog_ordering();
}
示例12: yit_woocommerce_catalog_ordering
function yit_woocommerce_catalog_ordering() {
if ( ! is_single() ) {
woocommerce_catalog_ordering();
}
}
示例13: prdctfltr_respond_550
//.........这里部分代码省略.........
$prdctfltr_global['unique_id'] = key($pf_requested);
$active_filters = isset($opt['pf_filters']) && is_array($opt['pf_filters']) ? $opt['pf_filters'] : array();
$curr_filters = array();
foreach ($active_filters as $k => $v) {
$curr_filters = array_merge($curr_filters, $v);
}
if ($opt['pf_set'] == 'shortcode') {
$prdctfltr_global['sc_init'] = true;
$prdctfltr_global['sc_query'] = $opt['pf_shortcode'];
$prdctfltr_global['active_permalinks'] = $opt['pf_shortcode'];
if (isset($prdctfltr_global['pagefilters'][$prdctfltr_global['unique_id']]['atts'])) {
extract($prdctfltr_global['pagefilters'][$prdctfltr_global['unique_id']]['atts']);
$prdctfltr_global['ajax_js'] = isset($prdctfltr_global['pagefilters'][$prdctfltr_global['unique_id']]['args']) ? $prdctfltr_global['pagefilters'][$prdctfltr_global['unique_id']]['args'] : array();
$prdctfltr_global['ajax_atts'] = isset($prdctfltr_global['pagefilters'][$prdctfltr_global['unique_id']]['atts_sc']) ? $prdctfltr_global['pagefilters'][$prdctfltr_global['unique_id']]['atts_sc'] : array();
} else {
if (is_array($prdctfltr_global['pagefilters'])) {
$pf_pagefilters = $prdctfltr_global['pagefilters'];
reset($pf_pagefilters);
$sc_key = key($pf_pagefilters);
extract($prdctfltr_global['pagefilters'][$sc_key]['atts']);
$prdctfltr_global['ajax_js'] = isset($prdctfltr_global['pagefilters'][$sc_key]['args']) ? $prdctfltr_global['pagefilters'][$sc_key]['args'] : array();
$prdctfltr_global['ajax_atts'] = isset($prdctfltr_global['pagefilters'][$sc_key]['atts_sc']) ? $prdctfltr_global['pagefilters'][$sc_key]['atts_sc'] : array();
}
}
$prdctfltr_global['sc_ajax'] = true;
$prdctfltr_global['action'] = $action !== '' ? $action : '';
$prdctfltr_global['preset'] = $preset !== '' ? $preset : '';
$prdctfltr_global['disable_overrides'] = $disable_overrides == 'yes' ? 'yes' : 'no';
$pagination_args = array('sc' => 'yes', 'ajax' => 'yes', 'type' => $pagination);
} else {
$prdctfltr_global['ajax_adds'] = $opt['pf_adds'];
$pagination_args = array();
$use_filter = 'yes';
}
if (!isset($prdctfltr_global['done_filters']) || $prdctfltr_global['done_filters'] !== true) {
WC_Prdctfltr::make_global($curr_filters, 'AJAX');
}
$data = array();
if ($opt['pf_mode'] == 'archive') {
$query = self::make_query();
if ($opt['pf_restrict'] !== 'pagination') {
foreach ($pf_request as $filter => $options) {
if (in_array($filter, $pf_requested)) {
ob_start();
$prdctfltr_global['unique_id'] = $filter;
if ($options['widget_search'] !== 'yes') {
if ($use_filter == 'yes') {
include WC_Prdctfltr::$dir . 'woocommerce/loop/product-filter.php';
}
} else {
$widget_options = $opt['pf_request'][$filter]['widget_options'];
$defaults = array('style' => 'pf_default', 'preset' => '', 'disable_overrides' => 'no', 'action' => '');
foreach ($defaults as $k => $v) {
if (!isset($widget_options[$k])) {
$widget_options[$k] = $v;
}
}
if (isset($opt['pf_widget_title'])) {
$curr_title = explode('%%%', $opt['pf_widget_title']);
}
the_widget('prdctfltr', 'preset=' . $widget_options['style'] . '&template=' . $widget_options['preset'] . '&disable_overrides=' . $widget_options['disable_overrides'], array('before_title' => stripslashes($curr_title[0]), 'after_title' => stripslashes($curr_title[1])));
}
$data[$filter] = ob_get_clean();
}
}
}
$data['products'] = self::get_products($query);
if (isset($prdctfltr_global['ranges'])) {
$data['ranges'] = $prdctfltr_global['ranges'];
}
$data['pagination'] = self::get_pagination($pagination_args);
if (isset($opt['pf_count_template'])) {
global $wp_query;
$wp_query = $query;
if ($wp_query->found_posts > 0) {
ob_start();
woocommerce_result_count();
$data['count'] = ob_get_clean();
} else {
$data['count'] = '';
}
}
if (isset($opt['pf_orderby_template'])) {
if (!isset($_GET['orderby']) && isset($prdctfltr_global['active_filters']['orderby'])) {
$_GET['orderby'] = $prdctfltr_global['active_filters']['orderby'];
} else {
if (!isset($_GET['orderby'])) {
$_GET['orderby'] = 'date';
}
}
if (isset($_GET['orderby'])) {
$orderby = $_GET['orderby'];
ob_start();
woocommerce_catalog_ordering();
$data['orderby'] = ob_get_clean();
}
}
}
wp_send_json($data);
}
示例14: thb_woocommerce_theme_before_content
function thb_woocommerce_theme_before_content()
{
?>
<?php
if (!is_product()) {
?>
<header class="pageheader">
<h1><?php
woocommerce_page_title();
?>
</h1>
<h2><?php
woocommerce_result_count();
?>
</h2>
</header><!-- /.pageheader -->
<?php
}
?>
<?php
if (is_shop()) {
?>
<?php
woocommerce_catalog_ordering();
?>
<?php
}
?>
<?php
get_template_part('partial-header-closure');
?>
<?php
thb_page_before();
?>
<section id="content">
<?php
}
示例15: content
public static function content($is_ajax = false)
{
global $wp_query;
?>
<?php
if (is_singular('product')) {
while (have_posts()) {
the_post();
wc_get_template_part('content', 'single-product');
}
} else {
?>
<?php
/**
* script
* {{
*/
if (!$is_ajax) {
wp_enqueue_script('vendor-carouFredSel');
}
?>
<?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
$current_view_mode = dh_get_theme_option('dh_woocommerce_view_mode', 'grid');
if (isset($_GET['mode']) && in_array($_GET['mode'], array('grid', 'list'))) {
$current_view_mode = $_GET['mode'];
}
$grid_mode_href = $current_view_mode == 'list' ? ' href="' . esc_url(add_query_arg('mode', 'grid')) . '"' : '';
$list_mode_href = $current_view_mode == 'grid' ? ' href="' . esc_url(add_query_arg('mode', 'list')) . '"' : '';
$dh_ul_product_class = '';
$woo_products_pagination = dh_get_theme_option('woo-products-pagination', 'page_num');
if ($woo_products_pagination === 'infinite_scroll') {
$dh_ul_product_class = 'infinite-scroll-wrap';
} elseif ($woo_products_pagination === 'loadmore') {
$dh_ul_product_class = 'loadmore-wrap';
}
?>
<div class="shop-toolbar">
<?php
if (!dh_get_theme_option('woo-shop-filter', 0)) {
?>
<?php
woocommerce_catalog_ordering();
?>
<?php
}
?>
<div class="view-mode">
<a class="grid-mode<?php
echo $current_view_mode == 'grid' ? ' active' : '';
?>
" title="<?php
esc_attr_e('Grid', 'sitesao');
?>
" <?php
echo $grid_mode_href;
?>
><i class="fa fa-th"></i></a>
<a class="list-mode<?php
echo $current_view_mode == 'list' ? ' active' : '';
?>
" title="<?php
esc_attr_e('List', 'sitesao');
?>
" <?php
echo $list_mode_href;
?>
><i class="fa fa-list"></i></a>
</div>
<?php
if (dh_get_theme_option('woo-shop-filter', 0)) {
?>
<div class="filter-toggle-button">
<a class="filter" title="<?php
esc_attr_e('Filter', 'sitesao');
?>
" href="#"><i class="fa fa-filter"></i> <?php
esc_html_e('Filter', 'sitesao');
?>
</a>
</div>
<?php
}
?>
</div>
<?php
//.........这里部分代码省略.........