Hi
I would like the differ the count of posts shown on the home page of my blog vs other page i.e on the home page ( navigation page 1 ) i would like 3 posts shown but when i navigate to page 1,2..99 via the pagination i want there to be 4 posts show. I tried this with hooks but so far it’s failing.
add_filter('pre_get_posts', 'posts_on_page', 1);
function posts_on_page($query){
if ( $query->is_home() && $query->is_main_query() && ! is_admin() ) {
$query->set( 'posts_per_page', 3 );
}else{
$query->set( 'posts_per_page', 4 );
}
}
It continues to show the post per page configured in “Settings->Reading->Blog pages show at most”
Can someone help please ?
thanks
Scott