• Hello,
    Is there any way to remove the starting <li />-tag in the function wp_list_categories()?
    If I display the categories like this:
    wp_list_categories('orderby=name&show_count=1&title_li=<h2>' . __('Categories') . '</h2>');
    I get this result:

    <li class="categories">
      <h2>Categories</h2>
      <ul>
        <li>...<li>
      </ul>
    </li>

    I want to remove the <li class=”categories”> and

Viewing 5 replies - 1 through 5 (of 5 total)
  • I don’t know if it’s possible, but you can simply add different styling for the first li and for the second one, like this:

    /* first li */
    li {
         code: here;
    }
    
    /* second li */
    li li {
         code: here;
    }

    kodysmith

    (@kodysmith)

    I’m not sure if it’s documented, I found it via Google and it works:

    wp_list_categories('title_li=0');
    Ben Sutcliffe

    (@bsutcliffe)

    It is documented here. You can use title_li= or title_li=0 on all functions that respond with a list.

    t31os

    (@t31os)

    If you leave everything off the end of title_li=, you’ll get no title, but it’ll drop the LI…

    Just do it like so..
    <?php wp_list_categories('orderby=name&amp;show_count=1&amp;title_li=');?>

    Then add a title above it manually if you want it..

    Example::

    <h2>Categories</h2>
    <?php wp_list_categories('orderby=name&amp;show_count=1&amp;title_li=');?>

    Of course without the ‘amp;’ part which is still being added by the WP forum… *sigh*

    MichaelH

    (@michaelh)

    Of course without the ‘amp;’ part which is still being added by the WP forum… *sigh*

    Reported this problem to the wp-forums email list. See http://comox.textdrive.com/pipermail/wp-forums/2009-April/004932.html

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘wp_list_categories() without a starting <li />’ is closed to new replies.