I have the following code which gives be posts that are published in the last 100 days
function smbd_cats_by_days ($where = '') {
$where .= " AND post_date < '" . date('y-m-d', strtotime("-100 days")) . "'";
return $where;
}
add_filter('posts_where', 'smbd_cats_by_days');
It is working fine. But now I want to make this function generic. (ie) I want the number of days to be stored in a variable instead of hard coding it as 100.
How to do that?