我正在创作一家基于作者的woocommerce商店。我尝试做的只是作者展示帖子,客户订单链接到产品作者..
这是我到目前为止所得到的:
var argv = require('yargs')
.number(['l','w'])
.demand(['l','w'])
糟糕,我被困在订单部分。有人有建议吗?
感谢。
答案 0 :(得分:1)
we need to now add this to our sorting dropdown and our WooCommerce settings.
<?php
function sv_custom_woocommerce_catalog_orderby( $sortby ) {
$sortby['alphabetical'] = 'Sort by sell: alphabetical';
return $sortby;
}
add_filter( 'woocommerce_default_catalog_orderby_options', 'sv_custom_woocommerce_catalog_orderby' );
add_filter( 'woocommerce_catalog_orderby', 'sv_custom_woocommerce_catalog_orderby' );
//Add Alphabetical sorting option to shop page / WC Product Settings
function sv_alphabetical_woocommerce_shop_ordering( $sort_args ) {
$orderby_value = isset( $_GET['orderby'] ) ? woocommerce_clean( $_GET['orderby'] ) : apply_filters( 'woocommerce_default_catalog_orderby', get_option( 'woocommerce_default_catalog_orderby' ) );
if ( 'alphabetical' == $orderby_value ) {
$sort_args['orderby'] = 'author';
$sort_args['order'] = 'asc';
$sort_args['meta_key'] = '';
}
return $sort_args;
}
add_filter( 'woocommerce_get_catalog_ordering_args', 'sv_alphabetical_woocommerce_shop_ordering' );
?>