WordPress.org

Ready to get started?Download WordPress

Forums

wp_list_categories output (3 posts)

  1. omcfarlane
    Member
    Posted 6 years ago #

    I'm hoping someone can please shed some light on this for me. I've been up and down the forums but can't find anything that really explains this.

    Why does:
    <?php wp_list_categories('title_li=<h2>' . __('Categories') . '</h2>&echo=0' ) ?>

    output:

    <li class="categories">
    <h2>Categories</h2>
    <ul>
    <li>Item 1</li>
    <li>Item 2</li>
    </ul></li>

    Instead of:

    <h2>Categories</h2>
    <ul>
    <li>Item 1</li>
    <li>Item 2</li>
    </ul>
    ?
    And a better question, how does one get it to behave properly? I'd imagine something like this would be what I'm looking for, but I don't know how to tweak it to call categories instead of pages.

    Thanks for any input.

  2. JamesICT
    Member
    Posted 6 years ago #

    Try this perhaps...

    <h2>Categories</h2>
    <ul>
    <?php wp_list_categories('title_li='); ?>
    </ul>
  3. omcfarlane
    Member
    Posted 6 years ago #

    Understandable, but I don't understand why if there is the title tag, does it nest it improperly like that. I mean, am I the only one that thinks so?

Topic Closed

This topic has been closed to new replies.

About this Topic