How can I make a category selection/monthly archive drop-down menu?
So, you’d like to use a drop-down menu to select the category or monthly archive to visit instead of a regular text listing of either one. Try using something like this:
Category Drop-Down
<form name="catmenu" action="">
<select name="selcat"
onchange="location=document.catmenu.selcat.options[document.catmenu.selcat.selectedIndex].value;">
<option value="">--Select Category--</option>
{exp:weblog:categories weblog="yourweblog" style="linear" dynamic="off"}
<option value="{path=weblog}">{category_name}</option>
{/exp:weblog:categories}
</select>
</form>
Monthly Archive Drop-Down
<form name="monthmenu" action="">
<select name="selmonth"
onchange="location=document.monthmenu.selmonth.options[document.monthmenu.selmonth.selectedIndex].value;">
<option value="">--Select Month--</option>
{exp:weblog:month_links weblog="weblog1"}
<option value="{path=index}">{month} {year}</option>
{/exp:weblog:month_links}
</select>
</form>
You’ll want to be sure to edit the {path=} variable above to correspond to what you need.
(Note: The above code uses javascript to submit the data when you select a category. It may not work with all browsers. You can always remove the javascript and just add a standard HTML submit button.)
