• ianatkins

    (@ianatkins)


    Hello All,

    I’m trying to make a listing on the single post view, that displays 4 older posts. Instead of ordering by date, I was thinking it might be quicker and easier to just filter with a WHERE statement on ID.

    This doesn’t seem to work though, any ideas:

    function filter_where( $where = '' ) {
    	$where .= " AND ID < ".$post->ID;
    	return $where;
    }
    add_filter( 'posts_where', 'filter_where' )
    query_posts('posts_per_page=4&cat=11');

    Thanks
    Ian.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Where Clause on ID’ is closed to new replies.