Quantcast
Viewing all articles
Browse latest Browse all 20145

Reply To: [Assigned] How to filter by current category archive?

Please try this:
1) modify codes in your theme/functions.php as below:

add_shortcode('wpv_show_curent_tax_slug', 'wpv_show_curent_tax_slug_func');
function wpv_show_curent_tax_slug_func() {
  if( is_category() ) {
    global $wp_query;
    $term = $wp_query->get_queried_object();
    return $term->slug;
  }
}

2) edit your view, change the filter from "Categories the same as the current page" to:
Categories set by the View shortcode attribute "wpvcategory" using the operator IN
eg. [wpv-view name="view-name" wpvcategory="xxxx"]

3) in WP admin side, Views-> Settings
Third-party shortcode arguments, fill the shortcode name wpv_show_curent_tax_slug

4) add a text widget into your sidebar, with the views shortcode like this:
[wpv-view name="my view name" wpvcategory="[wpv_show_curent_tax_slug]"]


Viewing all articles
Browse latest Browse all 20145

Trending Articles