Support » Fixing WordPress » Convert wp_list_bookmarks from unordered list to table?

  • Resolved dalemoore


    Any one know how to convert the output of wp_list_bookmarks from an unordered list to, instead, a table – with each LI become instead a TD? The only thing I’ve found similar is this post: which doesn’t seem to work for me, even after changing get_bookmarks to wp_list_bookmarks. It just outputs the bookmarks like usual and then adds an empty table after it. I know it’s not tabular data technically, but, I need it to be a table anyway because the layout needs to work in IE6+ and what I need to do can’t be done except in CSS3, unless it’s a table. Thanks for any assistance.

Viewing 3 replies - 1 through 3 (of 3 total)
  • This might help:

    $bookmarks = wp_list_bookmarks('title_li=0&categorize=0&echo=0');
    $table_rows = preg_replace('/<li>/','<tr><td>',$bookmarks);
    $table_rows = preg_replace('/<\/li>/','</td></tr>',$table_rows);
    echo "<table>$table_rows</table>";

    You could also just use before and after parameters of wp_list_bookmarks() rather than the preg_replace.

    Thanks, vtxyzzy! Your solution works perfectly.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Convert wp_list_bookmarks from unordered list to table?’ is closed to new replies.