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

This is my code snapshot

im using this code to get the posts of the categories but the problem is this code is getting one less value than actual if there are total 5 post its getting 4 any when can plz check it .......... another thing is for first row it works properly but for second row it gets one less post

share|improve this question
please post the code properly, or use pastebin.com to share the code. – Michael Aug 15 '12 at 14:41
up vote 0 down vote accepted

Right now it seems like there is no query regarding the amount of posts to be shown.

Try adding this above your WHILE argument:

global $query_string;
query_posts( $query_string . '&posts_per_page=5' );
share|improve this answer
Consider using query_posts( add_query_arg( array( 'posts_per_page' => 5 ), $query_string ) ); – Tom Auger Aug 15 '12 at 15:16
and just a reminder that if you have sticky posts this can affect what get's returned eg you expect 2 posts but find you are getting 3. – Damien Aug 15 '12 at 15:30
i have just figured out the solution .. the elseif structure is not working in this code so i just removed the else and place another if instead of elseif ..... now its working properly – Aqeel Aug 15 '12 at 19:05

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.