WordPress tutorials: Bookmarks in dropdown list

Wpsnipp – Bookmarks in dropdown list. Adding this PHP code to your wordpress theme will add your bookmarks within whatever category you choose to be displayed within a select menu. Don’t forget to change the category ID in line 4.



<select onchange="location = this.options[this.selectedIndex].value;">
$bookmarks = array();
$bookmarks = get_bookmarks("category=3");
if ($bookmarks[0] != '') { ?>
<?php foreach ( $bookmarks as $bookmark ) {?>
<option value="<?php echo clean_url($bookmark->link_url); ?>"> <?php echo $bookmark->link_name; echo $bookmarks->term_id; ?> - <?php echo $bookmark->link_description; ?></option>
<?php }} ?>

Be Sociable, Share!

Leave a comment