• hoangcoltech

    (@hoangcoltech)


    Hi

    Suppose i want to get a list of posts and all posts in this list has ID > 100 and < 150.

    I read documentation but couldn’t find anywhere describe how to comparing in wordpress query.

    I tried this:

    query_posts(“ID>100&ID<150”);
    and
    query_posts(“p>100&p<150”);

    But unsuccessful.

    Someone can tell me how to do this with wordpress query ?

Viewing 1 replies (of 1 total)
  • Justin Greer

    (@justingreerbbi)

    you could just run if statement on the query output.

    if($post->ID >= '100' || $post->ID <= '150'){
        <!-- Info for each post here -->
    }

    Not tested but this is what I do a lot of times if I am looking for a way to filter post on a query where wordpress can not

Viewing 1 replies (of 1 total)
  • The topic ‘Query list of posts by comparing post ID ?’ is closed to new replies.