Too Many Categories, Too Little Room? Here’s the Fix
I started running out of space in the sidebar. There were almost 50 different Categories which ran well past the first fold.
What to do? What to do? I decided I needed to shorten the list, but then things would be mixed together and lose the effect of having categories in the first place.
So, I did the next best thing. I added some code to the sidebar which would give me a Drop Down Menu. This way, I would still have all the posts in the proper categories and gain much needed space in the sidebar.
If you would like to set up your Category list with a Drop Down menu (it replaces your get_categories php) like the one in my sidebar…
Here is the code:
<h2>Categories</h2>
<ul class=”sellLi”>
<form action=”<?php bloginfo(’url’); ?>” method=”get”>
<?php wp_dropdown_categories(’show_count=1&hierarchical=1&orderby=name’); ?><br />
<input type=”submit” name=”submit” value=”View” />
</form></ul>
You, of course, can use the <li> (list) function instead of the <ul class…> function if you prefer, depending on the look you want.
I think it works pretty well, what do you think?
Important Update:
If you followed the comments below at all Des Walsh mentioned that he had problems trying to use the code in his Sidebar. I mentioned that he seemed to be using Widgets as opposed to his normal sidebar php.
Php code doesn’t work using Widgets. I did try, but nothing I tried worked… UNTIL I found a Plugin written by Otto that allows the use of php code within a Widget! Go to his post Fun with Widgets and look for the execphp.zip file.
Download it, unzip it, upload it to your server wp-plugins file and you will be able to use the above php code in the Widgets and you will have the same DropDown Menu you see in my Sidebar.
New Here? You may want to Subscribe to my RSS feed for daily updates. Or if you prefer, Subscribe by Email What is RSS? Thanks for visiting!
Related Posts:








My Skype: joe.hauckes