Top

Daily Tip: How to Display All Your WordPress Categories in a Drop Down Menu

April 2, 2010

Do you have too many categories to display in your navigation menu? If you want to conserve space on your page but still want to make those categories available, you can easily add them all to a drop down menu like so:

<form action="<?php bloginfo('url'); ?>/" method="get">
<?php
$select = wp_dropdown_categories('show_option_none=Select Category&amp;show_count=1&amp;orderby=name&amp;echo=0&amp;selected=6');
$select = preg_replace("#<select([^>]*)>#", "<select$1 onchange='return this.form.submit()'>", $select);
echo $select;
?>
<noscript><input type="submit" value="View" /></noscript>
</form>

Drop that anywhere in your theme’s template files where you want the category drop down menu to appear.

Credit: WPBeginner.com

Tweet This Post

Comments

Got something to say?

Bottom
Article Archive  |  This site is a historical archive of pressography.com, a WordPress plugin and theme blog that published between 2006 and 2012. It is preserved for reference and is not operated by, affiliated with, or endorsed by its original authors. Nothing here is for sale and no form on this site is active. If you are the original owner and would like this domain returned, please get in touch.