サイドバーの月別アーカイブへのリンクをドロップダウンメニューにするコード。wp_get_archive() にはあらかじめ option タグで表示させるためのパラメータ format が用意されているので、 root/wp-content/themes/your_template/sidebar.php の
<?php wp_get_archives('type=monthly'); ?>
の記述を、
<form name="archive_pulldown"> <select name="archive_option"> <option>月別アーカイブ</option> <?php wp_get_archives('format=option'); ?> </select> <input type="button" value="GO" onClick="window.location = (document.forms.archive_pulldown.archive_option[document.forms.archive_pulldown.archive_option.selectedIndex].value);" /> </form>
に置き換えることで、プルダウンメニューによる各アーカイブへのリンクが実現します。
<?php wp_get_archives(’format=option‘); ?> を
<?php wp_get_archives(’format=option&type=postbypost‘); ?> に修正することで個別のアーカイブページをプルダウンメニューにすることも出来ます。
wp_get_archive() の詳しいパラメータについての説明は wordpress.org/wp get archives へ。