How To Display Your Tags In A Dropdown List Menu In WordPress

What’s great about a dropdown list interface is that it saves your site some real estate. It frees up some space on the layout for you to put in other contents and features.

WordPress’ default category widget is displayed as such but unfortunately the same cannot be said about the tags list. Good thing there’s a hack that allows your tags to be displayed in the same manner as well. Hafiz Rahman of WPLover shows us how in today’s featured WordPress tutorial. All you have to do is apply the same wp_dropdown_categories() function that WordPress use to display your category.

Simply paste the code below onto where you’d like to have the dropdown menu displayed. Hafiz notes that you can use and provide your own taxonomy by modifying the code in line 6, which contains the parameter taxonomy=post_tag.

<li id="categories">
 <h2><?php _e('Posts by Tags'); ?></h2>
 <form action="<?php bloginfo('url'); ?>/" method="get">
 <div>
<?php
$select = wp_dropdown_categories('taxonomy=post_tag&show_option_none=Select tag&show_count=1&orderby=name&echo=0');
$select = preg_replace("#<select([^>]*)>#", "<select$1 onchange='return this.form.submit()'>", $select);
echo $select;
?>
 <noscript><div><input type="submit" value="View" /></div></noscript>
 </div></form>
</li>     

Incoming search terms for the article:

Related Posts

Creating a Psychedelic Art Effect in Your Portraits

EWWW Image Optimizer

Inspirational Photo Retouches By Cristian Girotto

Create Your Own Sticker Design Via Photoshop