Support » Fixing WordPress » Avoid sub-category posts on parent category page

  • Hi
    This question has been up many times, but since all solutions I’ve found are outdated I give it a try:
    How can I avoid posts in a sub-category from being displayed on the parent-category page?
    I have a parent category called Culture and children categories called Film and Articles. On the Culture page i don’t want to see the posts, just the sub categories.
    Any plugin or code that could fix this?
    Thanks!
    Kjetil

Viewing 5 replies - 1 through 5 (of 5 total)
  • Read this section of the Codex: Include or Exclude Categories.

    Wherever your categories are listed in your template, you look for code like this:

    <?php
    wp_list_categories(); ?>

    And change it to this:

    <?php
    wp_list_categories('depth=1'); ?>

    Drat. I misread the original post.

    Okay, read this: The Loop: Exclude Posts from Some Category.

    The examples are pretty good on that page, so I’ll leave it at that.

    Thanks a lot. I’ll save this one.
    I found an other solution, though. Instead of making parent/child categories i made just the children (but as normal categories). Then I made the “parent” pages as static pages with the introduction and links to the “children” from there.
    After all, the categories won’t change much, so the most important was to make it possible to post to the child pages.
    http://www.dolcevita.no/wp/kultur/ is a static page and the two lower links go to category overview pages for articles and video/books
    (Never mind Cucina Italiana – its an external link)
    Kjetil

    You guys missed this nice little plugin:
    http://guff.szub.net/2007/11/30/kinderlose/

    Thanks, Moshu.
    Found it a couple of days later and thought I’d mentioned it here.
    It seems to work fine also in WP 2.51 though its compatibility listing stops at 2.3.
    For some strange reason its not listed in the WP plugins directory.
    Kj

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Avoid sub-category posts on parent category page’ is closed to new replies.