Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Can anyone tell me why this isn't working? Assuming two things here - 1. WP Query handles multiple page requests, and 2. doesn't need a reset because I'm creating a new WP Query. What happens is I only get the last page to be shown (389). Above this code on the same page there is another WP Query that only fetches one page. Could this be the reason, or is it the way I request the pages? I've tried applying all the reset handlers but they gave no effect.

The code -

<?php $promo = new WP_Query( array( 'post_type' => 'page', 'post__in' => array(62,18,389) ) ); while ($promo->have_posts()) : $promo->the_post(); ?>
<?php the_permalink() ?>
<?php the_post_thumbnail() ?>
<?php the_title() ?>
<?php the_excerpt() ?>
<?php endwhile; ?>
share|improve this question
    
If you have found a solution, add it as an answer and mark your question as answered. –  toscho Mar 10 '12 at 8:53

2 Answers 2

Because your posts are only saved whithin the $promo var and not in the $wp_query global var. I recommend you to use get_posts() http://codex.wordpress.org/Template_Tags/get_posts

share|improve this answer
    
Thanks for the tip. I solved it using a get_pages query and a foreach loop instead. –  Staffan Estberg Oct 27 '11 at 20:09

You need to do paging in the WP Query to make it work right (using paged parameter)

share|improve this answer
3  
Welcome to WordPress Stack Exchange. May I ask you to add a small working example? Rather abstract one-liners are frustrating to read for most of our members. :) –  toscho Mar 10 '12 at 8:56

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.