In the wordpress settings => Reading => Blog pages show at most [input field] posts
I have it set to 3 posts at the moment.
On my index, date archives, tag archives, category archives, search results, etc… All pages that use the loop and paging, it shows 3 posts per page now.
My goal is to be able to have different number of results for different pages. ON my index maybe have 3 posts but on search results or archives, show a different number of results per page.
Any ideas how to do this?
This will do it: (add to your theme’s functions.php)
Improving on the answer above: hook
pre_get_posts
is fetched by reference, thus it does not require aglobal
call or areturn
call.Using $GLOBALS[‘wp_query’] or just $wp_query