• I’ve searched through all of the plugins, and through the forums, and I have yet to find a resolution for this that works with 2.6, so I apologize if I missed something, but I’ve been looking around for days. I’m trying to find either a plugin or code That will show only my top parent categories, however, when you click on that category and go to it’s posts page, I want to show it’s subcategories (just that particular parent cat) either nested or even bulleted. (Or nothing, I could always style it in css)

    Alternatively, since therr are many themes where you can put your parent cats into the regular navigation, like in the header, a plugin or widget that only shows subcats, nothing else, of that parent cat. On the Home Page, it would probably collapse to nothing. (I like this one better)

    I’ve tried a plethora of plugins and widgets already, like Folded Tree, tried some custom php I’ve seen here, but nothing. I’m hoping somebody has a line on this.

    Thank you.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter rumblepup

    (@rumblepup)

    Wow, I was thinking that I would at least get a “why would you want to do that?” post.

    Still, any ideas?

    For listing only parent categories, use wp_list_categories with the include= parameter.

    <?php wp_list_categories('orderby=name&include=3,5,9,42'); ?>

    Duplicate category.php to make a custom template for a parent category (category-42.php here) and then put something like this in it:

    <?php wp_list_categories('child_of=42&title_li=&use_desc_for_title=0'); ?>

    I’ve been searching for the same thing, for months, and I think I finally figured it out on my site. This is the code I use in my sidebar template to show only the parent categories. You need to use the DEPTH function and set it to 1, which is “only parent.” Hope this helps:

    <ul><li>
            <h2><?php _e('Categories'); ?></h2>
    
                <ul>
                <?php wp_list_cats('sort_column=name&depth=1'); ?>
                </ul>
    
            </li></ul>
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Show SubCategories when Click on Parent’ is closed to new replies.