WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a static page which runs two loops but pagination doesn't work on the second loop.

  1. The first loop shows the static content of the page
  2. The second loop shows the last 3 blog posts

Pagination shows up, adds /page/2 to the url but it always shows just the same 3 posts. Why doesn't this work as expected?

First loop: display the static content

if (have_posts()) : while (have_posts()) : the_post();
    the_content('<p class="serif">Read the rest of this page &raquo;</p>'); ?>
endwhile; endif;

Second loop: shows the last 3 posts and pagination

global $more;
$more = 0;
$temp = $wp_query;
$wp_query= null;

$wp_query = new WP_Query();

while ($wp_query->have_posts()) : $wp_query->the_post();

share|improve this question

You aren't setting the $paged variable, at least not in the code posted.

Per the Codex, you need to do something like this:

$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;

... before trying to use the $paged variable. That is, it needs to come before this line:


Also, side note, what is this-- php the_content(); ? That is going to trigger an error. Why do you have the php there?

share|improve this answer
thank you, I removed the "php".I've added that code and yes, I forgot it but it doesn't work either. The url on the pagination element remains /page/2 but it just doesn't work! – Andrea Puiatti Apr 5 '13 at 14:10

Your Answer


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.