• This is ridiculous… I’ve spent hours on what should be a simple task, and looking around the web and at the codex, I’m not the only one.

    Here’s the scenario…
    The parent category has an id of 2. When they go to that parent category (let’s call it “beer”), I want all the subcategory names to display at the top, with links to those subcategories. In short, I want to provide shortcuts, if people are only interested in “miller” or “molson” and don’t want to read all of “beer”.

    Now, having the cats display in only one category is as easy as
    'if (cat == "2") {'

    Now, the obvious choice would be list_cats(), but I don’t want all cats, only the children of 2. So, lets go with
    'list_cats('child_of=2');'

    Nope.

    How ’bout:
    'list_cats('child_of=2&categories=2');'

    Nope.

    Exclude is no good to me, because there’s already a lot of categories and as soon as the client adds a new one (and they will), it will break.

    There is no include, to limit to only one category.

    So does anyone have any ideas? Please?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter tbaxter

    (@tbaxter)

    Pretty please?

    Try wp_list_cats('child_of=2').

    Thread Starter tbaxter

    (@tbaxter)

    I shoulda mentioned, I’m on 1.5.

    wp_list_cats returns nothing, no matter how I set it. I think it was deprecated for 1.5.
    list_cats(‘child_of=2’), like I said above, returns everything, ignoring the child_of argument.

    list_cats doesn’t take an argument list in query string form, it takes explicit arguments. Calling as you are you are setting the optionall parameter to "child_of=2" which makes not one lick of sense.

    wp_list_cats() is not deprecated in 1.5. I’m on 1.5 and 1.5.1-alpha and it works dandy. Calling the function as I did for what I told you works. Are you calling this on categories with emtpy children? If so, call it like this:

    wp_list_cats('child_of=2&hide_empty=0')

    Thread Starter tbaxter

    (@tbaxter)

    Weird. I can’t get wp_list_cats to return anything, no matter what arguments (or none at all) I give.

    Does it work outside your if (cat==’2′) conditional?

    What I’m trying to ascertain is whether it has something to do with the conditional or the wp_list_cats function.

    Gareth

    Thread Starter tbaxter

    (@tbaxter)

    Nope. No matter what I do, I return everything or nothing at all.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Need children category names to appear on parent category page’ is closed to new replies.