Archived topic
hide categories into widget categories
3 replies · Started by Sebastien on May 21, 2019
Hi,
I use the nativ WP "category" widget to display the list of categories into my blog page.
1) I do not want to display all the categories. I would like to hide several categories into this list (without hiding any post displayed in the blog page!)
what is the way to do that?
2) Is there a way to filter (exclude specifics taxonomies) the posts displayed into the Blog content?
I wonder where the limit is between nativ GP Blog and WPSHOWPOST. In this case I could either
* GP Bloc + Filter php ? (exluding some tag)
* or Keeping the nativ Post + Disabling Blog nativ GP + creating new archive page with WPSHOWPOST displaying Post (excluding some Tag)
* Or create a dedicated Custom Post Type and a dedicated Archive page(with WPSHOWPOST)
thank
Hi there,
1. Try this function:
function custom_category_widget($args) {
$exclude = "1,2,3"; // Category IDs to be excluded
$args["exclude"] = $exclude;
return $args;
}
add_filter("widget_categories_args","custom_category_widget");
2. Exclude posts by taxonomy - this topic should help:
https://generatepress.com/forums/topic/need-separate-page-for-blog-post-category/#post-643002
Thanks you so much,
1) The function works.
2) That exactly what I was looking for =) =)
Glad to be of help