Matrym
Matrym

Reputation: 17053

Wordpress - query_posts

Is there a way to query multiple specific posts? For example, the following gets one:

        // retrieve one post with an ID of 670
        query_posts('p=670');   

But as far as I can tell, I can't extend this to do two posts, separated by commas. Does anyone know a better way?

Upvotes: 0

Views: 304

Answers (1)

Daniel Lo Nigro
Daniel Lo Nigro

Reputation: 3424

This should work:

query_posts(array('post__in' => array(670, 671, 672)));

Source: http://codex.wordpress.org/Function_Reference/query_posts#Post_.26_Page_Parameters

Upvotes: 1

Related Questions