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();


1 Answer 1


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?

  • 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! Commented Apr 5, 2013 at 14:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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