WordPress.org

Support

Support » How-To and Troubleshooting » List all sub-categories from specific parent?

List all sub-categories from specific parent?

  • I’m trying to put some code together that will list all the sub-categories from a specific parent.

    I need to keep the structure like I’ve posted it below so the buttons are styled correctly.

    <ul class="guide-navigation">
    <li><a class="guide-button" href="cat-1-link"><span>Sub Cat 1 Name</span></a></li>
    <li><a class="guide-button" href="cat-2-link"><span>Sub Cat 2 Name</span></a></li>
    </ul>

    I’m not sure how to go about doing this so any help would be greatly appreciated.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The Codex is your friend.

    <ul class="guide-navigation">
    <?php wp_list_categories('child_of=3'); ?>
    </ul>

    At this point you will need to change your style sheet to match the code output by WordPress.

    @kalessin, thanks but is there any way to keep the structure the same as in my original post?

    The reason I want to keep it the same is because I’m using a special method for rounded corners with css. I think it needs the span part for it to work properly.

    cheers.

    Could still do with some help! thanks.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘List all sub-categories from specific parent?’ is closed to new replies.
Skip to toolbar