Hi @Ryan Long:
You have two problems:
- You need to wrap the result of
date( 'Y-m-d' , $newdate );
in a SQLDATE()
function, and - You define
$ayearago
outside of thefilter_where()
function so it’s not in scope within the function. You need to move the code that sets$ayearago
into thefilter_where()
function like this:
function yoursite_filter_where($where="") {
$today = date('Y-m-d');
$newdate = strtotime ( '-1 year' , strtotime ( $today ) ) ;
$ayearago = date( 'Y-m-d' , $newdate );
$where .= " AND post_date >= DATE('{$ayearago}')";
return $where;
}
Let me know if that works for you…