Support » Fixing WordPress » Formatting wp_list_bookmarks()

  • Greetings, all

    I recently upgraded to WordPress 2.1 and found my links page was giving me a MySQL error instead of displaying each of the categories and links.

    After exploring around the documentation a bit, I found the tag wp_list_bookmarks() that seems to do exactly what I want. The only problem is that it puts the category headers into an unordered list, and the links themselves into a nested list. (You can see what I mean here:

    I’d like to change the output so each of the category headers is wrapped in an H3 tag, and the category links are in their own list. Like so:

    <h3>Category 1</h3>
    <li>Link 1</li>
    <li>Link 2</li>
    <h3>Category 2</h3>
    <li>Link 3</li>

    Is this possible?

Viewing 3 replies - 1 through 3 (of 3 total)
  • I think you specify the order, etc. by including the appropriate information within the parenthesis. Take a look at that function in /wp-includes/bookmark-template.php.

    I’ve tried experimenting with the parameters available for the tag, but still can’t seem to coax the output to resemble my example above.

    Maybe I’m missing something obvious, but can anyone offer a working example?

    I got this to work:


    The trick is to pass some null values (just pass the paramater, no equal sign) for category_before and category_after. To use h3 instead of h2, use the title_before param.

    I know this original post was a little old, but I was just now looking for this very solution. Hope it helps someone…

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Formatting wp_list_bookmarks()’ is closed to new replies.