chevron-up bell reply instagram twitter2 feed3 finder search-25px-p0

Woocommerce order by the category product widget

2015-10-30

之前在做一个跟wordpress相关的一个项目的过程中,甲方要求商品的 Woocommerce 顺序在各个页面是一致的。然而 Woocommerce 自己提供的关于排序的功能不是很健全。这就导致了在不同的页面

[ux_product_categories type="row" number="20" orderby="slug" order="desc" show_count="0"]

你可以添加新的排序:

public function __construct() {
    $this->widget_cssclass    = 'woocommerce widget_product_categories';
    $this->widget_description = __( 'A list or dropdown of product categories.', 'woocommerce' );
    $this->widget_id          = 'woocommerce_product_categories';
    $this->widget_name        = __( 'WooCommerce Product Categories', 'woocommerce' );
    $this->settings           = array(
            'title'  => array(
                    'type'  => 'text',
                    'std'   => __( 'Product Categories', 'woocommerce' ),
                    'label' => __( 'Title', 'woocommerce' )
            ),
            'orderby' => array(
                    'type'  => 'select',
                    'std'   => 'name',
                    'label' => __( 'Order by', 'woocommerce' ),
                    'options' => array(
                            'order' => __( 'Category Order', 'woocommerce' ),
                            'slug' => __( 'Slug', 'woocommerce' ),
                            'name'  => __( 'Name', 'woocommerce' )
                    )
            ),
            'dropdown' => array(
                    'type'  => 'checkbox',
                    'std'   => 0,
                    'label' => __( 'Show as dropdown', 'woocommerce' )
            ),
            'count' => array(
                    'type'  => 'checkbox',
                    'std'   => 0,
                    'label' => __( 'Show product counts', 'woocommerce' )
            ),
            'hierarchical' => array(
                    'type'  => 'checkbox',
                    'std'   => 1,
                    'label' => __( 'Show hierarchy', 'woocommerce' )
            ),
            'show_children_only' => array(
                    'type'  => 'checkbox',
                    'std'   => 0,
                    'label' => __( 'Only show children of the current category', 'woocommerce' )
            ),
            'hide_empty' => array(
                    'type'  => 'checkbox',
                    'std'   => 0,
                    'label' => __( 'Hide empty categories', 'woocommerce' )
            )
    );

    parent::__construct();
}

有一个插件叫做 Category Order and Taxonomy Terms Order:

Category Order and Taxonomy Terms Order

 

arkilis

Make Your Comments