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

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

1 Answer 1

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'";
}
2
  • EDIT: post date >= 2013-08-01
    – Anjum
    Commented Aug 18, 2013 at 8:03
  • no problem, accept answer by clicking on tick icon to mark as solved.
    – Anjum
    Commented Aug 18, 2013 at 8:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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