Wordpress Archive drop down yearly

admin

Administrator
Staff member
I have a yearly archive drop-down select box on wordpress. Here is the code:

Code:
<select name="archive-dropdown" onchange="document.location.href=this.options[this.selectedIndex].value;">
<option value=""><?php echo esc_attr( __( 'Select Year' ) ); ?></option> 
<?php wp_get_archives( 'type=yearly&format=option&show_post_count=0' ); ?>
</select>

Once I select a year, say 2006, the drop down box should display 2006. At present it shows the default "Select Year".