WordPress.org

Ready to get started?Download WordPress

Forums

TDO Tag Plugin and excluding categories (2 posts)

  1. simophat
    Member
    Posted 4 years ago #

    Hi,
    I am using the TDO Tag plugin and it works great! however i have encountered a random stumbling block which i wonder if you could help me with!?

    basically on a WordPress category archive page, posts from that category and all its child categories are displayed.

    I want to limit the category archive page to just display the posts that have been categorized in that category, and not in any of its children categories.

    For example, imagine there is category ‘A’ and ‘A’ contains children categories ‘b’, ‘c’ and ‘d’. When users click on category ‘A’ i just want to display posts in category ‘A’ and not any from children ‘b’, ‘c’ and ‘d’.

    The only way i have found to do this is through a custom wordpress query (specifically using the ‘category__in’ function) before the loop. This is the code i tried to use based on this suggestion: http://www.kristarella.com/2010/03/wordpress-exclude-child-categories-from-category-archives/
    The code i use before the loop is:

    $paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1;
    $current_cat = get_query_var(‘cat’);
    $args=array(
    ‘category__in’ => array($current_cat),
    ‘paged’ => $paged
    );
    query_posts($args);

    However when i try to use this function, it breaks the ‘TDO Tags’ plugin.

    The website i am developing this for is here: http://www.basedonbirds.com/theclimatehub2
    as you can see i really rely on the tags plugin for the development of this site.

    I am lost for ideas. Any help would be so much appreciated! Thanks and cheers for the great plugin.

    Simon

  2. simophat
    Member
    Posted 4 years ago #

    Actually... i found the solution
    check it out here:

    http://wpengineer.com/exclude-subcategories-in-a-loop/

Topic Closed

This topic has been closed to new replies.

About this Topic