Return most recent post by date range

¬Article by Hariadi with 1 comment
8 May 2008

Open functions.php from the template file and add this function:

function show_month_posts($where) {
global $wpdb;

$how_long = 60; //60 days

//if( !is_single() && !is_page() )
if( is_home() )

$where .= " AND $wpdb->posts.post_date >= ADDDATE(CURRENT_DATE(), - $how_long)";

return $where;
}
if (is_home ) add_filter('posts_where', 'show_month_posts');
Tags: ,
Category: How-To, WordPress

There are 1 comment. Leave a comment!

Name (Req)

E-mail (Req)

URI

Message

pages

categories

archives

Promotion

blogroll