add_filter( 'facetwp_sort_options', 'options_per_url', 10, 2 );
function options_per_url( $options, $params) {
$uri = FWP()->helper->get_uri();
if ( $uri == 'demo/product-tag/catalog') {
$options = [
'default' => [
'label' => __( 'New arrivals', 'fwp' ),
'query_args' => [
'orderby' => 'date',
'order' => 'DESC',
]
],
'popularity_new' => [
'label' => 'Popual',
'query_args' => [
'orderby' => 'post_views',
'order' => 'DESC',
]
]
];
}
else {
$options = [
'price_asc' => [
'label' => 'Price ASC',
'query_args' => [
'orderby' => 'meta_value_num',
'meta_key' => '_price',
'order' => 'ASC',
]
],
'price_desc' => [
'label' => 'Price DESC',
'query_args' => [
'orderby' => 'meta_value_num',
'meta_key' => '_price',
'order' => 'DESC',
]
],
}
return $options;
}
© 2023 Simplesteps for WordPress
Theme by Anders Norén — Up ↑