Archived topic
Number of posts on blog/home vs category
4 replies · Started by David on September 16, 2016
Is there any way to have a different number of posts on the blog/home page vs categories/archives?
So for example, I'd like to display 7 posts on the home page but have 12 posts on the categories/archives.
The reason I want to do this is so that my home page can have one large featured post at the top, and 6 smaller posts in two columns below. And then on the category page I can have 9 posts (all the same size) in three columns. If I use the same number for both then I'll be left with an uneven number of posts in the final row on one of the sections (which doesn't look good).
I know this could be achieved by using the WP Show Posts plugin to create a custom home page, but ideally I would prefer not to use that since it makes it more difficult to display the posts how I want to.
Thanks!
I think I may have found a solution here :)
Something like this might help: http://wordpress.stackexchange.com/questions/47683/using-pre-get-posts-to-set-posts-per-page-how-do-i
Your conditional would be: if ( $query->is_category() ) :
Even better, thanks Tom!
No problem :)