How to add drop-down menu for links?
-
Can you help me with the code for this?
On my blog, I have 3 categories of links: Pictures, RSS Feed, and Videos. Right now, in the sidebar, I list all of these using wp_list_bookmarks(‘orderby=id’). What I would like to do is put the Pictures in a drop-down menu to select, and then list the RSS Feed and Videos just like I am now…
Can anyone help me out?
Thanks.
-
There is no way (that I know of) to create a dropdown menu using wp_list_bookmarks.
Could it work somehow with get_bookmarks? I tried, but to no avail…
Hi,
Try with these plugins:
http://wordpress.org/extend/plugins/wordpress-css-drop-down-menu/
http://wordpress.org/extend/plugins/ryans-suckerfish-wordpress-dropdown-menu/Also Refer:
http://codex.wordpress.org/Function_Reference/get_bookmarksThanks,
Shane G.
None of those were working for me… Maybe I just don’t know enough code…
In my sidebar – the following code works for my drop-down archive:
<li><h2>Archives</h2> <ul> <select name=\"archive-dropdown\" onChange='document.location.href=this.options[this.selectedIndex].value;'> <option value=\"\"><?php echo attribute_escape(__('Select Month')); ?></option> <?php wp_get_archives('type=monthly&format=option&show_post_count=1'); ?> </select> </ul> </li>
So – I am a little confused as to why the following doesn’t work for a Pictures drop-down box a little below that in the sidebar:
<li><h2>Pictures</h2> <ul> <select name=\"picture-dropdown\" onChange='document.location.href=this.options[this.selectedIndex].value;'> <option value=\"\"><?php echo attribute_escape(__('Select Pictures')); ?></option> <?php get_bookmarks('category_name=Pictures'); ?> </select> </ul> </li>
Any thoughts?
I guess it can’t be done…
are you talking about putting pictures in the main nav bar?
A drop-down menu of my picture links in the sidebar…
bump for anyone who might have an idea…
<?php $test = wp_list_bookmarks('echo=0&title_li=&categorize=0'); $test = str_replace('<li','<option',$test); $test = str_replace('/li>','/option>',$test); echo $test; ?>
Would work…. however i’ve found that WordPress is removing any option tags i plonk in the template file..
You can verify that wordpress does this by replacing “option” in the above code to anything else.. “opt10n” for example would work, but is no good since it’s totally invalid code.
- The topic ‘How to add drop-down menu for links?’ is closed to new replies.