0

I am currently showing a daily archive using the following

 <?php wp_get_archives('type=daily&limit=15'); ?>

It shows all the older posts as daily archives. However, Is it possible to show the archives only after a specific dates. For instance, I would like to show daily archives from August 1, 2013 onward only and not any post which was published before that.

I have tried to use the following code but somehow does not work

<?php
function ($where) { return $where . ' AND  (post_date)>= 2013-08-01 '; }
add_filter('getarchives_where');
?>
<ul>       
<?php wp_get_archives('type=daily'); ?>
</ul> 

Thanks

  • you can use getarchives_where filter to filter your wp_get_archives(); query – Anjum Aug 18 '13 at 7:49
1

do so like this

add_filter( 'getarchives_where', 'my_archives_filter_function', 10, 2 );

create function

function my_archives_filter_function($text, $r) {
     return "WHERE post_type = 'post' AND post_status = 'publish' AND post_date >= '2013-08-01'";
}
  • EDIT: post date >= 2013-08-01 – Anjum Aug 18 '13 at 8:03
  • no problem, accept answer by clicking on tick icon to mark as solved. – Anjum Aug 18 '13 at 8:14

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.