WordPress.org

Support

Support » How-To and Troubleshooting » list_cats Display in Nested List

list_cats Display in Nested List

  • Maybe I’m just missing something reading through the code, but is there a way to cause the list_cats function to output the list of categories in a nested, list based on their parent-child relationships? I tried changing some of the function parameters with no success and I can’t find anything in the forums about it. Anyone? Thanks in advance!

Viewing 15 replies - 1 through 15 (of 18 total)
  • The default _is_ to list categories in parent-child hierarchical nested list (there is a ‘hierarchical’ parameter in list_cats() and wp_list_cats(), but either it or the ‘list’ parameter must be specifically set to false/off.

    If you’re not seeing this, it’s possible the menu/sidebar ul and li tag properties in your stylesheet are overriding how it’s displayed.

    Woh, you can’t edit posts anymore :/

    What are the arguments at current for your list_cats function?

    wp_list_cats isn’t displaying a hierarchy for me (on 1.5). It’s not the CSS because I’ve viewed the source and its not producing the HTML for a nested list at all.

    I’ve also replicated the error on multiple themes.

    Any clues?

    I’m using the base stuff from the ‘nolimits’ theme. The PHP call is:

    <?php list_cats(0, ”, ‘name’, ‘ASC’, ‘/’, true, 0, 1); ?>

    My HTML output is:

    <h2>Categories:</h2>

    Teas, Wines should be sub-lists under Beverages.

    Doh!!


    <h2>Categories:</h2>

    Hmmmm….

    <h2>Categories:</h2>

    <h2> Categories:</h2>

    {h2}Categories:{/h2}
    {ul}
    {li}{a href=”http://www.devrandom.org/?cat=2″ title=”View all posts filed under Technology”>Technology{/a> (2){/li}
    {li}{a href=”http://www.devrandom.org/?cat=8″ title=”View all posts filed under Beverages”>Beverages{/a> (1){/li}
    {li}{a href=”http://www.devrandom.org/?cat=9″ title=”View all posts filed under Wines”>Wines{/a> (1){/li}
    {li}{a href=”http://www.devrandom.org/?cat=10″ title=”View all posts filed under Teas”>Teas{/a> (1){/li}
    {/ul}

    That’s what my code snippet prints out. Sorry for the multi-paste erors.

    Presumably we arent going to get nested lists with an h2 tag in there ?

    I have the same problem under 1.5

    sub-categories listing as separate categories.

    ME too!!! is this something as a bug under 1.5?

    I have <?php wp_list_cats(“sort_column=name&showempty=1&optioncount=1”); ?> and it won’t do anything but list all my categories and subcategories in non-alphabetical order. =(

    my wp_list_cats has no options. I’m using the Aesthetic theme. I emailed the theme maker, but no response from 3 days ago, must be busy. Or its a 1.5 thing.

    hrm, edit is off.

    I did check a 1.2.2 blog I use, and it has no options either. Yet it displays the subs under the parent category.

    So it must be a change in 1.5

Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘list_cats Display in Nested List’ is closed to new replies.
Skip to toolbar