WordPress.org

Ready to get started?Download WordPress

Forums

List all sub-categories from specific parent? (4 posts)

  1. ThreeVisual
    Member
    Posted 5 years ago #

    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.

  2. Kalessin
    Member
    Posted 5 years ago #

    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.

  3. ThreeVisual
    Member
    Posted 5 years ago #

    @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.

  4. ThreeVisual
    Member
    Posted 5 years ago #

    Could still do with some help! thanks.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.