Created
January 24, 2014 19:48
-
-
Save kaseybon/8604713 to your computer and use it in GitHub Desktop.
Only displays WordPress posts from the last 30 days. Also works with custom post types.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
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); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment