• Ok so i found the code which excludes posts from the homepage but i wanted to alter it so that it excluded categories form different pages as you can see on my website my homepage
    critgaming.com and
    critgaming.com/minecraft

    are completely different times and i want different categories as the main page is a template for a different pages and i will need different categories for atleast 6 different pages.

    function exclude_category($query) {
    if ( $query->is_home ) {
    $query->set(‘cat’, ‘-xx’);
    }
    return $query;
    }
    add_filter(‘pre_get_posts’, ‘exclude_category’);

    so how can i edit this to exclude from a different page than home.
    categories are are home (id 1) and minecraft (id 8) and page slug is minecraft

Viewing 1 replies (of 1 total)
  • First off, your links don’t work, so I can’t see your example.

    I may be misunderstanding what you want, therefore, and I may, anyway, be mistaken, but I would have thought it much more easy to create specific category lists that are inclusive rather than exclusive.

    For example, if you had categories for “workshops” and “residencies” and you wanted a list to include both of these, but not your categories, “blog”, say, and “news”…

    I would have thought the easiest thing to do would have been to create a parent category for the workshops and residencies—let’s call it, “consultancy”—and have a category list on your navigation menu for “Consultancy”. If all your Workshops and Residencies posts are also in the Consultancy category, this should show a list of both of those, but not anything else.

    But as I say, maybe I’ve misunderstood what you want.

    Cheers

    PAE

Viewing 1 replies (of 1 total)

The topic ‘Excluding categories from different pages’ is closed to new replies.