WordPress.org

Ready to get started?Download WordPress

Forums

Only Viewing Child Categories (2 posts)

  1. thescott18
    Member
    Posted 9 years ago #

    Hey everyone, newbie here. I'm modifying a template, and it has the following code.

    {list_cats optionall='1' all='All' sort_column='name'}

    How can I get it so that it displays only the child categories of a particular index number? I've been searching, but all the results I find don't match up to this syntax.

  2. tangible
    Member
    Posted 9 years ago #

    if the particul post is under the parent AND child category:
    <?php wp_list_cats('children=1&child_of=X'); ?>
    X = the category ID of the parent that has the child categories you want to display

    or

    if the particular post is only posted under the child category
    <?php wp_list_cats('hide_empty=0&children=1&child_of=2'); ?>

    of course you can add other options to that.. you can look it up in the WP codex

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.