Category and archive droppings
In the attempt to shorten the menu, I decided to put the lists of monthly archives and categories into drop down menus. I just realized that in time they will (at least the monthly archives) get longer and longer and longer…
So, my first problem was that I’ve made a hidden category for static pages and it would show on the menu if I used WP’s built-in dropdown_cats tag.
Luckily, Ria at Typed by has made a Drop Down Cats Plugin with ability to exclude. What’s nice about it is that it a) formats subcategories differently from parents (indented with a hyphen), and b) it includes a post count parameter.
Archive tag (wp_get_archives) has an option to format the list of archives as an option list. You just need to build a drop-down menu function around it. Thus, as found at the WordPress forums…
(remove the spaces after dots in “window.location=” if you’re going to cut-and-paste that — I needed to separate the words because it wouldn’t wrap nicely)
<form name="archiveform" action="">It includes a little JavaScript, but I don’t know if that can be avoided. I’m disappointed to notice that formatting the archives as options is not compatible with showing the post count.
<select name="monthly_arch" onchange="window.location = (document. forms. archiveform. monthly_arch[document. forms. archiveform. monthly_arch. selectedIndex].value);">
<option selected>Monthly archives</option>
<?php wp_get_archives('type=monthly&format=option'); ?>
</select>
</form>
But
In the same thread there was a solution to that too. It involves a little tweaking (or correcting…) in template-functions-general.php, function
get_archives_link around line 180, changingelse if ('option' == $format) {to
return '<option value="'.$url.'">'.$text.'</option>'."\n";
else if ('option' == $format) {
return '<option value="'.$url.'">'.$text.$after.'</option>'."\n";







