WordPress.org

Ready to get started?Download WordPress

Forums

Problem with list_cats() and categories with child (17 posts)

  1. Jeff Blaine
    Member
    Posted 10 years ago #

    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:
    Automotive
    - General
    - Blahblah2
    - ChildCategory3
    The default list_cats(0, 'All', 'name') produces:
    General
    Blahblah2
    ChildCategory3
    What if I then add a new parent and children as such:
    Noodles
    - General
    ...

  2. Jeff Blaine
    Member
    Posted 10 years ago #

    What I am saying is that I am expecting to see (what I consider correct):
    Automotive / General
    Automotive / Blahblah2
    Automotive / ChildCategory3
    Noodles / General

  3. Jeff Blaine
    Member
    Posted 10 years ago #

  4. TechGnome
    Moderator
    Posted 10 years ago #

    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: http://wiki.wordpress.org/list_cats
    I think the ones you might be interested in are hide_empty and children. Setting hide_empty to 0 and children to TRUE.
    TG

  5. Jeff Blaine
    Member
    Posted 10 years ago #

    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...

  6. Lorelle
    Member
    Posted 9 years ago #

    Have you figured this out yet?

  7. TechGnome
    Moderator
    Posted 9 years ago #

    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 http://tannagh.com ) and since kickslop never gave an example of the desired result, I couldn't help -- please note that this is several months old too.

    Tg

  8. Lorelle
    Member
    Posted 9 years ago #

    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.

  9. justkristin
    Member
    Posted 9 years ago #

    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!

  10. Lorelle
    Member
    Posted 9 years ago #

    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?

  11. midwinter
    Member
    Posted 9 years ago #

    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?

  12. enguyen
    Member
    Posted 9 years ago #

    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 http://ip-sj.org/wp/ , 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.

  13. swduncan
    Member
    Posted 9 years ago #

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

  14. enguyen
    Member
    Posted 9 years ago #

    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.

    Thanks,
    Eric

  15. enguyen
    Member
    Posted 9 years ago #

    fixed it!

    it's easy. see this post: http://wordpress.org/support/topic.php?id=23891#post-135958

    (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.

  16. pericat
    Member
    Posted 9 years ago #

    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.

  17. lquilter
    Member
    Posted 9 years ago #

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.