try the ‘post__in’ parameter:
http://codex.wordpress.org/Function_Reference/WP_Query#Post_.26_Page_Parameters
the query parameters are supposed to work with ‘get_posts()’ as well.
for example:
<?php
$args = array(
'numberposts' => 12,
'post__in' => array( 3, 17, 234)
);
$lastposts = get_posts( $args );
foreach($lastposts as $post) :
setup_postdata($post);
?>
Thanks alchymyth, I manage to get the posts I want but I am having trouble displaying them in the order I input them in.
<?php
$the_query = new WP_Query( array( 'post__in' => array( 44, 18, 36 ), 'orderby' => 'none' ) );
if( have_posts() ) :
while ($the_query->have_posts()) : $the_query->the_post();
?>
Any ideas?
you may need to use three ‘get_post()’ functions –
afaik, there is no way to have the posts show in any particular order, other than the ones provided by the query (date, title, ..)