How to link to posts in a certain date range
-
Hello,
I’m trying to figure out on how to link in a post to posts in a certain date range!If found the following in the function reference:
<?php
//Create a new filtering function that will add our where clause to the query
function filter_where($where = ”) {
//posts for March 1 to March 15, 2009
$where .= ” AND post_date >= ‘2009-03-01’ AND post_date < ‘2009-03-16′”;
return $where;
}
// Register the filtering function
add_filter(‘posts_where’, ‘filter_where’);
// Perform the query, the filter will be applied automatically
query_posts($query_string);
?>If I insert this into a post nothing is retrieved, the code just partialy show in the post.
What I’m doing wrong?
Thanks for any hints or help.
- The topic ‘How to link to posts in a certain date range’ is closed to new replies.