WordPress.org

Forums

Formatting wp_list_bookmarks() (4 posts)

  1. slap
    Member
    Posted 8 years ago #

    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: http://www.slapupsidethehead.com/resources/)

    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>
    <ul>
    <li>Link 1</li>
    <li>Link 2</li>
    </ul>
    <h3>Category 2</h3>
    <ul>
    <li>Link 3</li>
    <li>Etc.</li>
    </ul>

    Is this possible?

  2. rtcunningham
    Member
    Posted 8 years ago #

    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.

  3. slap
    Member
    Posted 8 years ago #

    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?

  4. Novak
    Member
    Posted 8 years ago #

    I got this to work:

    wp_list_bookmarks("title_before=<h3>&title_after=</h3>&category_before=&category_after);

    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...

Topic Closed

This topic has been closed to new replies.

About this Topic