WordPress Dropdown Monthly Archives

The most important feature in your blog's design is its usability, which let your readers get what they want easily. In order to keep your blog clutter-free, you must give some thoughts to your sidebar content, and arrange in less required space. There are thousands of WordPress plugins available, and it is very tempting to install them too. But, […]

The most important feature in your blog's design is its usability, which let your readers get what they want easily. In order to keep your blog clutter-free, you must give some thoughts to your sidebar content, and arrange in less required space. There are thousands of WordPress plugins available, and it is very tempting to install them too. But, they’ll surely increase, your server load, if you use alot.

The wise blogger knows to add only the plugins which will be beneficial. The WordPress codex has a lot of functions to achive without using resource hungary plugins for small functionality.

The biggest problem with monthly archives is that the size of the list grows every single month. Same is the case with categories, just imagine, if you’ve 100+ categories on your blog, taking up more and more room on you sidebar.

There is a way of getting around this; use a dropdown list. The drop-down takes up very little space, and is a recommended method of browsing through the archives.

In this post, we’ll implement “dropdown monthly archives and categories”. As, I’ve been asked by some of our reader, “how I’ve implemented dropdown category on my sidebar?”.

Here’s is how, it works:

Dropdown Monthly Archive:

<form id="archiveform" action="<?php echo $PHP_SELF ?>" method="post" style="text-align:center; margin: 0px; padding: 0px;">
	<select name="select" id="archive_chrono">
		<option value="">Monthly Archives</option>
		<?php get_archives("monthly","","option","","",true); ?>
	</select>
<input size="40" type="button" class="button" value="Go" onclick="window.location=(document.forms.archiveform.archive_chrono[document.forms.archiveform.archive_chrono.selectedIndex].value);"/>
</form>

Note: The above code is compatible with WordPress 2.3.x and 2.x versions. You can copy & paste in your sidebar to use it.

Dropdown Category:

I’ve posted codes for WordPress 2.3.x and 2.x series, before you copy & paste, make sure to check you WordPress version.

WordPress 2.x

<form name="category" action="<?php echo $PHP_SELF ?>" method="get" style="text-align:center; margin: 0px; padding: 0px;">
       <?php dropdown_cats(true, 'select category...', 'name'); ?>
		 <input size="40" type="submit" name="submit" class="button" value="Go"/>
     </form>

WordPress 2.3.x

<form action="<?php bloginfo('url'); ?>" method="get">
   <?php wp_dropdown_categories('show_count="1&hierarchical=1');" ?>
   <input type="submit" name="submit" value="view" />
   </form>
WordPress, WordPress 2.3.1, Dexter, Archives, Categories, Sidebar, Design, Layout, Dropdown, Tips and Tricks, Template, Code