December 2, 2007
7:33 pm

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

Loading

Contextual Related Posts:

2 Responses | RSS comments on this post | Leave a comment»

  1. 1
    DG says#2 | February 17th, 2009 at 2:59 am

    There's no ready WordPress hack /plugin available, but you can search for a combo box javascript on dynanicdrive.com or just Google it.

  2. 2
    Wolfgang says#1 | February 16th, 2009 at 3:28 pm

    Hi there!

    thanks for the useful code! I think that is what I've been searching for...

    Can you tell me, if it possible to put these querys together? So I can choose the period first (e.g. Jan 2009) and then choose the categorie (e.g. NEWS).

    When I click on "GO" I should get all Posts of the category NEWS in the period of JAN 2009... is that possible?

    I hpe you can anser me in the next few days!!!

    Thanks for all!

    Best regards
    Wolfi

No Pingback yet

PingBack URI

Leave a Response

Comment Preview
« Free License Keys For Camtasia Studio and SnagIt SoftwaresAttackers exploiting unpatched QuickTime flaw »
Feed Icon

Subscribe via RSS or email: