WordPress.org

Ready to get started?Download WordPress

Forums

How do i exclude children categories from wp_list? (4 posts)

  1. solidnuts
    Member
    Posted 4 years ago #

    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

  2. ryans149
    Member
    Posted 4 years ago #

    use depth='0'

  3. solidnuts
    Member
    Posted 4 years ago #

    ah i see now.. my lack of understanding is the problem then :P 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.

  4. ryans149
    Member
    Posted 4 years ago #

    I would suggest you to use this instead of wp_list_cats:

    <?php
    wp_list_categories('orderby=name&depth=0'); ?>

Topic Closed

This topic has been closed to new replies.

About this Topic