WordPress.org

Ready to get started?Download WordPress

Forums

wp_list_categories ignoring the "child_of" flag? (8 posts)

  1. palamedes
    Member
    Posted 6 years ago #

    On my homepage I am trying to get the categories list to be shorter than it is. I am doing this by trying to only show ONE level of children.

    http://info.rsow.com/

    "Dev Diary" is a child of 0.
    "RSoW.com" is a child of "Dev Diary"
    "JS/CSS Etc" is a child of "RSoW.com" and I don't want it listed there and it shouldn't be listed there as I have the child_of flag set to zero..

    Thoughts?

    Is there a better way to do this? I previously had written my own plugin to get around this with 2.04 and had hoped this would be resolved now, but still doesn't appear to be fixed..

  2. MichaelH
    Member
    Posted 6 years ago #

    Actually, if you have the child_of parameter set to 0 (zero) then the template tag, wp_list_categories(), wouldn't even show the RWoW.com Category.

    Unfortunately there is no "depth" parameter like wp_list_pages offers, so you may have to resort to just using the include= parameter.

    Please note, I should encourage you to upgrade to at least version 2.0.11 of WordPress for security reasons.

  3. palamedes
    Member
    Posted 6 years ago #

    I'm up to 2.32 now.. and this is what I'm using;

    wp_list_categories('title_li=&orderby=name&child_of=0&show_count=0');

    All children are being shown. Thoughts?

    Can we get Custom Fields with categories then so we can have some manipulation control similar to what we do with Pages?

  4. moshu
    Member
    Posted 6 years ago #

    child_of is NOT for excluding anything.
    With that parameter you can configure only to show children of X category. That's it. It does NOT work as an exclusion tool.

    See the Codex:

    child_of
    (integer) Only display categories that are children of the category identified by this parameter. There is no default for this parameter. If the parameter is used, the hide_empty parameter is set to false.

    Template_Tags/wp_list_categories

  5. palamedes
    Member
    Posted 6 years ago #

    Fine, then that means there is no way to set a depth, or to easily exclude stuff..

    (sorry but having to add to an exclusion list in the file each time I create a sub/sub category isn't acceptable)

    Is there a way for us to get custom fields with categories?

  6. MichaelH
    Member
    Posted 6 years ago #

    Custom fields are post oriented. Each post can have one or more custom fields assigned.

    This article in Codex, Displaying_Posts_Using_a_Custom_Select_Query, might give you some ideas.

  7. palamedes
    Member
    Posted 6 years ago #

    Okay thats fine, but that doesn't solve the issue.

    The issue here is, there is no way to easily exclude child categories from being displayed..

    There either needs to be a way to specify "depth" in the wp_list_categories function or add custom words to categories so the same custom select system can be applied to categories.

  8. MichaelH
    Member
    Posted 6 years ago #

Topic Closed

This topic has been closed to new replies.

About this Topic