[resolved] Listing Subcats on a Category Page (3 posts)

  1. elevenmedia
    Posted 9 years ago #

    I am a php newbee. I am tring to get a list of Child Categories listed on a Category page. If I have a Category called 'Books' I want it to write the Subcats of 'Books' on the page. I have the below code that gets me the category number and writes it .. which i dont need.

    I want the wp_list_categories to only list the children of the category they are in

    $cat = get_the_category(); $cat = $cat[0]; echo $cat->category_parent;
  2. MichaelH
    Posted 9 years ago #

    Seems all you would need would be:

    <?php wp_list_categories('child_of=21'); ?>

  3. elevenmedia
    Posted 9 years ago #

    I need it to be dynamic, so that if populates the 'child_of=' by figuring out what the parent is first


Topic Closed

This topic has been closed to new replies.

About this Topic