WordPress.org

Support

Support » How-To and Troubleshooting » How do i exclude children categories from wp_list?

How do i exclude children categories from wp_list?

  • I’m trying to use wp list in my template but i’d like to display all parent categories while hiding the children categories. could someone please help ? I’ve read all the codex wp_list functions with no luck.

    Right now I’m using this but it hides the parent of the category as well.
    <?php wp_list_cats('sort_column=name&exclude=265'); ?>

    Hope someone can help me. thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • use depth='0'

    ah i see now.. my lack of understanding is the problem then 😛 i don’t know php at all so if someone could post it here so i can simply copy paste it that would be great. I’d like to list all categories while excluding 265 and all children categories.

    i don’t know php so if someone could post it here so i can simply copy paste it that would be great.

    Thanks for your help.

    I would suggest you to use this instead of wp_list_cats:

    <?php
    wp_list_categories('orderby=name&depth=0'); ?>
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How do i exclude children categories from wp_list?’ is closed to new replies.
Skip to toolbar