Support » Requests and Feedback » wp_list_cats() children display problem

wp_list_cats() children display problem

  • I know this has been posted about before, in this forum, and elsewhere, but I can’t get it to work. All I want to do is display the top-level categories: meaning I don’t want any sub-categories, so, I would use this code:


    It should work, right?

    Edit: using latest release (1.5) of WP, hosted on apache, running on Ubuntu (linux)

Viewing 13 replies - 1 through 13 (of 13 total)
  • Yes, with the caveat that you misspelled wp_list_cats() in your example.

    please excuse that, a simple typo, rest assured that i did not misspell it within my code.

    also, that i did not mean to place this post within requests and feedback, i noticed that when after i placed it, and do not know how to get it moved.

    That’s okay. Unless you are a sysop, you will never get it moved.

    Information on this tag is found here with examples of how to set the children for the tag. One of those examples is as follows:

    <?php wp_list_cats('sort_column=id&child_of=8'); ?>

    Which sets the list to sort by ID and show only the children of category 8. If you do not want to show the children at all:

    <?php wp_list_cats('sort_column=id&children=0'); ?>

    If this is not working, check that you have put a ZERO and not an OH in the code, since this is actually a common boo boo. If this is close to what you used, then try retyping it and make sure you Refresh your screen completely to see the change take affect, if it does. If it doesn’t, come on back and we’ll take a better look.

    The codex was where I went in the first place, I in fact used a little bit of there code to assure myself that I wasn’t doing anything wrong, apparently, I still am.

    Both the code you supplied, and the codex, won’t stop children from displaying. I even created a child of a child, just to see if that would work: it didn’t.

    So far, no matter what I’ve done, I can’t get children to *not* display.

    Many people are unaware that there are two generations of WP tags in use – they often appear in parallel. In this case the new one is list cats (no wp prefix).
    You may find it has the functionality you need and is more robust. The problem is that many theme designers just reach for any old thing. On the codex as per usual.

    damn, good look. works fine. I knew it (list_cats()) existed, and I had tried it, but got lost in setting *all* the variables to get to the one i needed.

    the question is still there though: why would they share names, but not functionality? the codex says wp_list_cats can display only top-levels, but the code can’t.

    or can it? and there’s some black-magic voodoo i have to use to get it working?

    Thanks for the help, people 🙂

    Because AFAIK one has a bug in it and one does not.

    thanks for the help, buddy.

    You are welcome.

    I can’t find a way in either list_cats() or wp_list_cats() to give a ‘before’ or ‘after’ paramet. I’d like to set up the category list using a <dl> rather than

      Anyway to do this?



    Looks like my post was a little squished:

    I’ll put it all into words rather than code. I want to style my category list output from wp_list_cats() using a <dl> list rather than an unordered list.

    How do I do this?

    Thanks in advance.

    are you calling list_cats() or wp_list_cats() more than once? it appears that list_cats() can only be called once. if used elsewhere on the same page it results in no categories. perhaps that is your problem?

    there is a separate thread started specifically on this problem:

    the <dl> list guy: do you mean that you want parent-child categories, with the children categories hierarchical? there is a hierarchical=TRUE setting in wp_list_cats that does that.

    The solution posted here


    worked for me.

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘wp_list_cats() children display problem’ is closed to new replies.