WordPress posts_where and Offset
-
Hi,
I’m currently using the post_where filter to get posts from specific date period. For some reason, it does not work with offset. Have anyone done something like this before?
<?php function filter_where($where = '') { //posts in the last 10 days //$where .= " AND post_date > '" . date('Y-m-d', strtotime('-11 days')) . "'"; //posts 30 to 60 days old $where .= " AND post_date >= '" . date('Y-m-d', strtotime('-21 days')) . "'" . " AND post_date <= '" . date('Y-m-d', strtotime('-11 days')) . "'"; //posts for March 1 to March 15, 2009 //$where .= " AND post_date >= '2009-03-01' AND post_date <= '2009-03-15'"; return $where; } add_filter('posts_where', 'filter_where'); query_posts( 'cat=-3,-19,-88&offset=6&showposts=-1' ); ?>
posts_where: https://codex.www.ads-software.com/Plugin_API/Filter_Reference/posts_where
- The topic ‘WordPress posts_where and Offset’ is closed to new replies.