• Resolved catzavencu

    (@catzavencu)


    1. I’m tring to list categories in my header. But i don’t want to show child categories and at the same time i want
    to show empty categories, since are parents to other categories. If i use “include” or “exclude” parameters it doesn’t show empty categories. I tried “hide-empty=0”, doesn’t work.
    2.Suppose I have the categories:
    Activities
    Summer
    Winter
    Photo
    Black&White
    Mountains
    Rivers
    I have a template for Activities where i want to list child categories links with description. I tried this:

    ‘<?php wp_list_categories(‘include=5&title_li=’); ?>
    <?php echo category_description(5); ?>
    <?php wp_list_categories(‘include=6&title_li=’); ?>
    <?php echo category_description(6); ?>’
    where 5 and 6 are the “Summer” & “Winter” category ids. But instead of the category name it only shows flat “No categories”

    Any help is very much appreciated, Victor

Viewing 6 replies - 1 through 6 (of 6 total)
  • Moderator Samuel Wood (Otto)

    (@otto42)

    www.remarpro.com Admin

    hide_empty=0 does work, just make sure you spell it correctly. That’s an underscore between hide and empty, not a dash/minus character.

    Thread Starter catzavencu

    (@catzavencu)

    Thank you Otto.
    My second question wasn’t very explicit i guess. “Summer” (id 5) and “Winter”(id 6) are child categories of “Activities” and i want to list them on the “Activities” template page, both with description or better, with latest post excerpt in sub-category.
    I put this in “Activities” category template
    <?php wp_list_categories(‘include=5&title_li=’); ?>
    <?php echo category_description(5); ?>
    <?php wp_list_categories(‘include=6&title_li=’); ?>
    <?php echo category_description(6); ?>
    but it shows only the category description. Where the category link should be i only get “No categories”.

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.remarpro.com Admin

    The “No categories” message means that it didn’t find category 5 or 6, or those categories were empty and you did not specify hide_empty=0.

    Thread Starter catzavencu

    (@catzavencu)

    I used this
    <?php wp_list_categories(‘include=5&hide_empty=0’); ?>
    and i have posts in category 5. Still “no category” comes up.

    try this:

    <?php wp_list_categories('include=5&hide_empty=0&hierarchical=0'); ?>

    Thread Starter catzavencu

    (@catzavencu)

    It’s working. Thank you both Otto and Yoshi.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘wp_list_categories’ is closed to new replies.