Many thanks for the reply.
And I would add something like this code to my ‘archive.php’ script?
<?php
//based on Austin Matzko's code from wp-hackers email list
function filter_where($where = '') {
//posts in the last 30 days
//$where .= " AND post_date > '" . date('Y-m-d', strtotime('-30 days')) . "'";
return $where;
}
add_filter('posts_where', 'filter_where');
query_posts($query_string);
?>
Can you confirm if this is correct?
Should I add the above code to my script.
I only want to display posts in the past 3 months.
Thanks
Actually shouldn’t these these two line be:
//posts in the last 90 days
$where .= " AND post_date > '" . date('Y-m-d', strtotime('-90 days')) . "'";
Yes you can put that in your archives.php (or archive template) just before your loop that might be with something like <?php if (have_posts()) : ?>
Thanks for the reply, Michael 🙂
OK, so I go with:
<?php
//based on Austin Matzko's code from wp-hackers email list
function filter_where($where = '') {
//posts in the last 90 days
$where .= " AND post_date > '" . date('Y-m-d', strtotime('-90 days')) . "'";
return $where;
}
add_filter('posts_where', 'filter_where');
?>
<?php if (have_posts()) : ?>
Would the above do?