WordPress.org

Ready to get started?Download WordPress

Forums

Where Clause on ID (2 posts)

  1. ianatkins
    Member
    Posted 3 years ago #

    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.

  2. ianatkins
    Member
    Posted 3 years ago #

    Alas, it should work, no?

    Where are the ninjas?!

Topic Closed

This topic has been closed to new replies.

About this Topic