I am attempting to query posts with different quantity of ID's which are contained in a wide array.
My array (known as $my_array) appears like this:
Array (  => 108  => 129  => 145 )
And my Query appears like this:
<?php query_posts(array('post__in' => $my_array)); ?>
However this just returns one publish, the publish has got the ID from the first item within the array (108).
Have i got my syntax wrong?
$args = array( 'post_type' => 'page',//or whatever type 'post__in' => array(108,129,145) ); query_posts($args);
$arr=array(108,129,145); $args = array( 'post_type' => 'page', 'post__in' => $arr ); query_posts($args);
A person always has to create the
post_type using the
post__in argument. So that your line need to look such as the following:
<?php query_posts(array('post_type' => 'post', 'post__in' => $my_array)); ?>
Which will query the posts using the IDs you've within the array.