Category and child categories (1 post)

  1. Broomy
    Posted 9 years ago #

    After searching for ages I beginning to pull my hair out on this! I had some code working for pages where the child pages would be listed if there were any. It looked like this:

    <div id="sidebar">
    <?php if(wp_list_pages("child_of=".$post->ID."&echo=0")) { ?>
    <span class="navtitle"><?php bloginfo('description'); ?> Categories</span>
    <ul class="subnav">
    <?php wp_list_pages("title_li=&child_of=".$post->ID."&sort_column=menu_order&show_date=modified&date_format=$date_format&depth=1");?>

    <?php } else { ?>
    No Page
    <?php } ?>

    For a few reasons i'm trying to do exactly this for post categories, so if i'm on a post within a certain category it would show the child categories in the sidebar.

    Is this possible?

    Thanks for any help.

Topic Closed

This topic has been closed to new replies.

About this Topic