blog family garage photos links forums contact

02 April 2008

Blogger How-To: Archives in a Select Dropdown Menu and Resort by Most Recent

Are your Archives in Blogger getting too long? Mine did. I solved it by using this script that puts the Archives in the select dropdown menu and resorts it by the most recent archive month first.

First go to your Blogger template. Select all and copy the contents into Notepad, as a backup.

Second, replace the current Archive code with the following...

<select class="menu" name="ArchiveMenu" onChange="location.href=this.options[this.selectedIndex].value;">
<option value="/">Archives</option>
<script type="text/javascript">
var archives = new Array();
<BloggerArchives>
archives[archives.length] = new Array('<$BlogArchiveURL$>', '<$BlogArchiveName$>');
</BloggerArchives>
for (var i=archives.length-1;i>=0;i--)
{
document.write('<option value=\"' + archives[i][0] + '\">' + archives[i][1] + '</option>');
}
</script>
</select>


Third, add this to your CSS and modify it accordingly...

select.menu {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 11px;
font-color: #333333;
border: #111111 solid 1px;
}


Preview it, save and publish. Done!

Labels:

 0 Thoughts so far...

Post a Comment

Tommy Chang