[Resolved] hide categories into widget categories

Home Forums Support [Resolved] hide categories into widget categories

Home Forums Support hide categories into widget categories

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #906314
    Sebastien

    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

    #906756
    David
    Staff
    Customer Support

    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

    #906783
    Sebastien

    Thanks you so much,
    1) The function works.
    2) That exactly what I was looking for =) =)

    #906797
    David
    Staff
    Customer Support

    Glad to be of help

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.