Code To Display Categories In Drop Down Format In WordPress Blog

Posted by

Hi,

You can use this code to display your categories in drop down format:

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

Thanks,

Shane G.

One comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.