• I have to believe this is possible. I’ve searched the ends of the earth, but not turned up anything that applies.

    I use my sidebar for my main navigation. The navigation lists parent categories. When a parent is clicked, you arrive at the category page (via category.php in the Loop). I would like to display the subcategories that pertain to that category (as opposed to all of the subcategories)…and I only need to go one level deep.

    Clicking the list of sub-sub-categories would then either take you to a page that lists more subcategories, or eventually the post itself. Kind of like cookie-crumb navigation in reverse, and displayed in the body content of the category landing page.

    I’ve hit every external link that I could Google or find in this forum, followed every dead-end forum topic, and exhausted child_of, include, exclude, hierarchy and depth in the Loop in my category.php.

    This has got to be possible. Many, many, many thanks to ANYONE who has an answer. This seems to be a topic issue that many people have.

Viewing 2 replies - 1 through 2 (of 2 total)
  • You probably need to do something simular to the following:

    <?php
    if( is_category() ){
            //get current category id
    	$cat = get_query_var('cat');
            //list all cats that are children of current cat
    	wp_list_categories('child_of='.$cat.'&depth=1');
    }else{
            //list all top level categories
    	wp_list_categories('depth=1');
    }
    ?>

    Thread Starter andytford

    (@andytford)

    Close. But what do I do if the category has no subcategories and only contains a single post? I get:

    · Categories
    · No categories

    Also, I seem to be getting the sub-sub-categories as well that appear displayed on the main level with the subcategories. I adjusted the depth(s) but never got what I am truly after which is simply a listing of the subcategories of the parent category.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Completely at a loss…’ is closed to new replies.