Return to Snippet

Revision: 56717
at April 11, 2012 04:08 by crypticsoft

Initial Code
//swap out the category (33) for your own category
$links = wp_list_bookmarks('title_li=&categorize=0&sort_column=menu_order&show_name=1&echo=0&category=33&orderby=rand&limit=1');

//create array from string returned by wp_list_bookmarks
$bookmarks = explode('</li>', $links); 

//print without a link, if you want you could remove strip_tags() to bring the href back.
print '<p>' . strip_tags( $bookmarks[0] ) . '</p>';

Initial URL

Initial Description
Sometimes you just want a random link to display and outside of the default format, this works perfectly and removes all default html (list items / headings).

Initial Title
WordPress Links Manager - Display a random link from a category

Initial Tags
wordpress, links

Initial Language