[resolved] Archives outputting all child categories...how to limit? (3 posts)

  1. Craig Sunney
    Posted 5 years ago #

    Hello all.
    My first post here. Hope someone can help. Existing solutions stopped working on WP2.7

    This is about archive pages.

    While building a test site, I have noticed that WP lists an output of posts from all of a parent's sub-categories as well as the parent category.

    Said differently, on archive page "cat_parent" wp will also list posts from child_cat1.... child_cat2...child_catn

    How can I tell wordpress.

    On archive pages....just list posts from this category only, ignoring any child_category post, and ignoring grand_child_category posts too. Thanks wordpress :)

    P.S. I'm using Thesis theme, so ideally a custom function would be ideal for the custom_functions.php file. A styling class would be super too :) But all contributions welcome.

  2. MichaelH
    Posted 5 years ago #

    Could try this in your category template just before your loop:

    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    $current_cat = get_query_var('cat');
      'category__in' => array($current_cat),
      'paged' => $paged
  3. Craig Sunney
    Posted 5 years ago #


    Thank your for the reply!. This one took all weekend to workout.
    @Kristarella solved it. Documented here: WordPress: Exclude child categories from category archives

    Full workings for #Thesis hashed out here in DIYthemes forum

Topic Closed

This topic has been closed to new replies.

About this Topic