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 page template and on the page I have a loop such as:


The problem is that no posts are coming back when there should be about 5 or 6. Is there something wrong?

share|improve this question
up vote 0 down vote accepted

Firstly, use WP_query instead of query_posts:

Secondly, for (static) pages use the variable 'page' (not 'paged').

$my_query = new WP_query( 'post_type=post&posts_per_page=5&paged='  .get_query_var('page') );
if ( $my_query->have_posts() )  while( $my_query->have_posts() ) :
share|improve this answer
That still didnt work, also: $my_query->the_title() is wrong. you only use $my_query up until the_post(). everything after like content, title, thumbnail and so on does not need it. - UPDate: it works – TheWebs Mar 5 '13 at 20:54
I'm glad it helped. And sorry for the wrong title referencing. I guess, I was too busy doing copy/paste of $my_query->. ;) – tfrommen Mar 5 '13 at 22: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.