Home / bookmarks / Bookmarks in dropdown list
  • How to Bookmarks in dropdown list

    no thumbnail sorry: 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.

    ( click code to copy )

    wordpress snippet : PHP

    <>
    <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>
    

    ( WordPress codex functions, hooks, in this snippet. )

    get_bookmarks, link_description, get_bookmark, clean_url, selected, _n,