Some professional WordPress websites usually have custom post roll layout and different post count on homepage. So this means when you go to second page of post roll you should’t see repeating items as a consequence of another post count than set in ‘Blog pages show at most’ setting in Reading section of Settings in WP-admin.
Solving this problem is a simple code you need to add before wordpress loop in your index.php or home.php:
if ( is_home() ) { $posts_home = 9; //Set custom post number to show on home if( !is_paged() ){ query_posts("posts_per_page=$posts_home"); } else { if ( get_query_var('paged') != 2 ) $offsetting = $posts_home + ( ( get_query_var('paged') - 2 ) * get_query_var('posts_per_page') ); else $offsetting = $posts_home; query_posts($query_string . "&offset=$offsetting"); } }
Here $posts_home is a custom number of post count to show on homepage.
So where do you pit this code of yours in the index.php file? That info would have been helpful.
Ah, my apologies – nevermind. I see the “loop” now. Of course you could explain this for those who don’t know a lot about code. That would help.
Well, that whole string of code appears visibly at the top of my home page now. It worked for about two minutes then everything went back to the way it was.
Any suggestions?
Of course you have to make sure you open php tags if you insert this code into HTML part (should be before
I can’t even find this file.
Are you is this working? I tried with it but it is not working. I set $posts_home = 12 and my most post count is 25. When I go to second page, I missed 13 posts and it starts from 25th post to show…
Hey, I’ve updated code a bit, try it out please.
thanks so much for this snippet – I searched for hours finding a solution to this issue…
Thanks!
actually it need to insert
<?php
before the code and?>
after the code….thanks for the help!