how to add class to the ul returned by wp_list_bookmarks

wp_list_bookmarks returns HTML that has a ul with classes xoxo blogroll. I’d like to add another class to that ul, but can’t seem to find an elegant way to do so.

wp_list_bookmarks does accept an argument “class”, but that is applied to the li, not the ul. Is there some argument I’m missing? Or is there a hook I can hook onto and add a class?

Related posts

Leave a Reply

1 comment

  1. There is a filter 'wp_list_bookmarks' for the complete markup. You can use it:

    add_filter( 'wp_list_bookmarks', 'wpse40213_new_classes', 10, 1 );
    
    function wpse40213_new_classes( $html )
    {
        return str_replace( "class='xoxo blogroll'", "class='my_bookmarks blogroll'", $html );
    }