• Hello all,

    I’ve looked both here and on the Codex, and can’t seem to find the answer I need. Of course I may have missed it, please don’t hesitate to point me back to where I’ve missed the info (as if you would hesitate anyway!).

    In my Category.php page, I have

    <?php wp_list_cats('child_of='.$cat);?>

    before the Loop.

    This displays children items of the current category in a unordered list.

    The problem is that in order for it to work, I had to hardcode

    <ul> before the call, and </ul>
    after the call…

    This isn’t a problem per se, until you reach a category that doesn’t have children items. At that point, you end up with an empty

    <ul></ul>
    , which breaks validation and plays havock with the site.

    There doesn’t appear to be a before/after parameter for that tag.

    Any idea on how to best load the ul tag only if there are list items to be displayed?

    Thanks for any and all information.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter vavroom

    (@vavroom)

    Sorry for bumping, but has no one any idea on this??????

    Thread Starter vavroom

    (@vavroom)

    Another bump…

    Anyone? Anyone at all?

    I’ve been trying all variety of trying “if” statements. But I can’t seem to find the right “if”, or the right phrasing.

    I’ve tried if “empty”, or “==Null”, or any number of things. Doesn’t work.

    I suspect it’s an easy thing, I can’t imagine I’m the first one to run into this problem. I mean… wp_list_cats loading in
    <li> tags is fine, but one has to wrap that in
    <ul>. If there’s no children to display, then you have empty <ul> That doesn’t work…

    What am I missing?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘wp_list_cats ul before and after?’ is closed to new replies.