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:
Promote Your Home Business on the Featured Home Business Page... no charge, but no splogs allowed








My Skype: joe.hauckes
Thanks for sharing this. Sidebar clutter is a real challenge and anything that can reduce it without having a deleterious effect on functionality is to be warmly embraced. Now if you can show me how to collapse the tree of archives, that would be the icing on the cake!
Input by Des Walsh | August 17, 2007 @ 12:27 am
PS: tried it and my whole sidebar disappeared, so I’ve reinstalled the old code and the sidebar with the full list is back - mysterious
Input by Des Walsh | August 17, 2007 @ 4:24 am
Hey Des,
Don’t know why it didn’t work for you?!? You can see it works well here.
Give me a call at 610-931-3600, and I’ll see what I can do. NO CHARGE! (or you can use Jaxtr in the footer and it will be a free call.)
Because it’s something I suggested.
Input by Joe | August 17, 2007 @ 7:45 am
Des,
I just realized you’re in Australia, so talking on the phone might prove difficult.
I viewed your source code and it seems that you are using Widgets. You can’t uses Widgets and the sidebar php at the same time.
You would need to replace the code in the Category Widget itself and it should work fine.
Let me know either here or send me an eMail through my Contact Form
Joe
Input by Joe | August 17, 2007 @ 9:08 am
Hey Des,
See the Important Update in the post, I think it will solve your problem.
Input by Joe | August 18, 2007 @ 5:26 pm
Trackbacks
Sorry, the comment form is closed at this time.