Support » Fixing WordPress » Problem with list_cats() and categories with child

  • Why doesn’t list_cats()
    a) Take a delimiter string as an argument
    b) … then … use that delimiter to display proper category names?
    I have:
    – General
    – Blahblah2
    – ChildCategory3
    The default list_cats(0, ‘All’, ‘name’) produces:
    What if I then add a new parent and children as such:
    – General

Viewing 15 replies - 1 through 15 (of 16 total)
  • What I am saying is that I am expecting to see (what I consider correct):
    Automotive / General
    Automotive / Blahblah2
    Automotive / ChildCategory3
    Noodles / General

    actualy, that’s different. They are looking for functionality added…. so that child cats will be hidden until you are in that parent cat. Sounds like you are having trouble getting the child cats to show in the first place.
    list_cats() has lots of parameters:
    I think the ones you might be interested in are hide_empty and children. Setting hide_empty to 0 and children to TRUE.

    No, children does not do what I am looking for.
    I guess I don’t understand the point of child categories at all then the way it is currently implemented (and I don’t think my interpretation of the concept is that far out).
    It seems pointless to me. Can you explain to me what purpose they currently serve in 1.2? Why would I bother to make a top level ‘Recipes’ category and then children ‘Breads’, ‘Soups’, ‘Fish’ … if it’s not going to be displayed to the user in a hierarchy? I have to be missing something…

    Have you figured this out yet?

    Figured what out? Kickslop wasn’t all that clear on what he was looking for exactly. I’ve never had any issues getting my child cats to show properly under my parent cats (can be seen at ) and since kickslop never gave an example of the desired result, I couldn’t help — please note that this is several months old too.


    Thanks. Which is why I cleverly “bumped” it. I was looking for some more ideas on dealing with categories and their children. This is a complicated issue for a lot of people since the parent won’t show up unless there is a post to it, but its child does…unless this has been changed.

    TechGnome –
    I am having a helluva time trying to get my category children to indent nicely… Can you give me a sample? I have tried munging the list_cats options in as many ways as I could, but I keep somehow missing out… (It is an intranet site, or I’d show ya…) thank you!

    I’m also having trouble with the category children doing what I want them to do. Misbehaving little rascals.

    I would also like to only see them when their category is being visited, and not see the rest of the categories’ children. Is this possible?

    I’m having this same problem. I’ve got list_cats set to this:

    <?php list_cats(0, ”, ‘name’, ‘asc’, ”, 1, 0, 1, 1, 0, ‘TRUE’, ”,”,”,”,”,”) ?>

    And it doesn’t change anything, and the categories still do not organize themselves according to parents and children (instead, just an ABC list). I’ve put TRUE with and without quotes. No luck.

    Any help?

    I am also having this problem, guys. Also have list_cats set to this:

    <?php list_cats(0, ”, ‘name’, ‘asc’, ”, 1, 0, 1, 1, 0, ‘TRUE’, ”,”,”,”,”,”) ?>

    Example is at , for those who haven’t seen the problem. The hierarchy is flattened, and simply alphabetized.

    I’m using WP 1.5

    Thanks for the help, everyone.

    I too am having the same problem – everything’s flattened, adding hierarchical=1 didn’t work either.

    Could someone please answer this question? It’s either a) a simple problem and we’re all stupid for missing some setting, or b) a fairly significant bug.


    fixed it!

    it’s easy. see this post:

    (make sure to take the next post into account, as well.)

    it’s pretty annoying that it took this long for someone to crosspost the solution into this thread. i love wordpress, but it only takes one problem like this to negate all the time i’ve saved with having access to the code. this is why non-techies are so scared of open-source software.

    Just to point out that list_cats() takes 18 parameters, the last being the one that controls hierarchical display. For whatever reason, the default theme’s list_cats call only sets 17 of them. To get it to display hierarchical categories, you have to add a final ” , '1' ” just before the ending parens:

    <?php list_cats(0, '', 'name', 'asc', '', 1, 0, 1, 1, 1, 1, 0,'','','','','','1') ?>

    If you just stick a 1 in the 17th slot, you won’t get the display you’re trying for.

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘Problem with list_cats() and categories with child’ is closed to new replies.