Advertise on Site! You can Advertise on our site. Find out More

Display Categories in a drop down Menu

For showing the categories in drop down menu just use the following code.

<li id="categories"><h2><?php _e('Posts by Category'); ?></h2>
 <?php wp_dropdown_categories('show_option_none=Select category'); ?>

<script type="text/javascript"><!--
 var dropdown = document.getElementById("cat");
 function onCatChange() {
 if ( dropdown.options[dropdown.selectedIndex].value > 0 ) {
 location.href = "<?php echo get_option('home');
 dropdown.onchange = onCatChange;

For more information you can use the following code.


Add a Comment

Your email address will not be published. Required fields are marked *