X

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.



Code Snippet:


<select onchange="location = this.options[this.selectedIndex].value;">
<?php
$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 }} ?>
</select>

Comments  Leave a Reply

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

WordPress Launch Checklist

The Ultimate WordPress Launch Checklist

We've compiled all the essential checklist items for your next WordPress website launch into one handy ebook.
Yes, Send Me the Free eBook!