Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

share|improve this question
    
side note FYI: attribute_escape [has been deprecated][1] in favor of esc_attr [1]: codex.wordpress.org/Function_Reference/attribute_escape –  daxitude Mar 13 '11 at 21:58

1 Answer 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); ?>
share|improve this answer
    
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

 
discard

By posting your answer, you agree to the privacy policy and terms of service.