WordPress.org

Ready to get started?Download WordPress

Forums

Hiding child categories. (7 posts)

  1. marketanomaly
    Member
    Posted 8 years ago #

    I spent about two hours looking for how to hide child categories and I didn't see anything in the Codex, so I thought I would post another thread for others to find.

    If you want to hide the child categories, just use the following function in place of your current list_cats() function.

    <?php wp_list_cats('children=0'); ?>

    You may also want to check out.
    http://wordpress.org/support/topic/45095
    and
    http://codex.wordpress.org/Template_Tags/wp_list_cats

    I'll try to add something to the WordPress codex. If anyone else could add something more on this to the wordpress codex I'd be greatful!

    Thanks,

    Adam

  2. noise
    Member
    Posted 7 years ago #

    hmmmm... odd, it won't seem to work on my installation - I'm using WPmU would that be the reason?

  3. Kafkaesqui

    Posted 7 years ago #

    WPMU:

    http://mu.wordpress.org/forums

    They'd be more likely to know of variations (and bugs) with template tags in the multi-user version of WordPress.

  4. noise
    Member
    Posted 7 years ago #

    thanks - pretty quite over there.

    Also the wp_list_cats is placed in the header.php file - not sure if that makes a difference.

  5. Kafkaesqui

    Posted 7 years ago #

    All wp_list_cats() does is generate a list of categories. Unless one is modifying its behavior in some way, it should always work the same, no matter where it resides in your templates.

  6. noise
    Member
    Posted 7 years ago #

    hmm.. I wonder if it's a bug?

  7. noise
    Member
    Posted 7 years ago #

    moved the them onto another wp installation, the children=0 thing worked fine. Guess it's something in my installation.

    p

Topic Closed

This topic has been closed to new replies.

About this Topic