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');
?>/?cat="+dropdown.options[dropdown.selectedIndex].value;
 }
 }
 dropdown.onchange = onCatChange;
--></script>
</li>

For more information you can use the following code.

You may like following Articles!

15 thoughts on “Display Categories in a drop down Menu

  1. There are certainly a number of particulars like that to take into consideration. That could be a nice point to convey up. I supply the ideas above as basic inspiration however clearly there are questions like the one you deliver up the place crucial thing will probably be working in honest good faith. I don?t know if finest practices have emerged around things like that, however I am sure that your job is clearly identified as a good game. Each boys and girls really feel the impression of only a second’s pleasure, for the rest of their lives.

  2. Aw, this was a really nice post. In concept I would like to put in writing like this additionally – taking time and precise effort to make a very good article… but what can I say… I procrastinate alot and not at all appear to get something done.

  3. I’m really glad I have found this information. Today bloggers publish only about gossips and web and this is really annoying. A good web site with interesting content, that is what I need. Thank you for keeping this website, I will be visiting it. Do you do newsletters? Cant find it.

  4. Nice post! You truly have a wonderful way of writing which I find captivating! I will definitely be bookmarking you and returning to your blog. In fact, your post reminded me about a strange thing that happened to me the other day. I’ll tell you about that later…

Leave a Reply

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

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>