0

Here is my current code which shows a dropdown list of all years daily post archive.

<select name="archive-dropdown" onChange='document.location.href=this.options[this.selectedIndex].value;'> 
  <option value=""><?php echo attribute_escape(__('Select Issue')); ?></option> 
  <?php wp_get_archives('type=daily&format=option'); ?> </select>

But i want to show a specific year daily post archive into dropdown list. (eg. only 2010 daily post archive will show into dropdown list)

Pls help me.

Thanks in advance, Onirban

1
<?php
function foo($where) { return $where . ' AND  YEAR(post_date) = 2010 '; }
add_filter('getarchives_where', 'foo', 1, 10);
?>
<select name="archive-dropdown" onChange='document.location.href=this.options[this.selectedIndex].value;'>
<option value=""><?php esc_attr_e( __('Select Issue') ); ?></option>                                                               
<?php wp_get_archives('type=daily&format=option'); ?>
</select>                                                                       
<?php remove_filter('getarchives_where', 'foo', 1, 10); ?>
  • wow great!!! its working .. thank you very much Marchin... and also thanks to daxitude for informed us new function. – user3940 Mar 14 '11 at 19:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy