Job Roller - Blog Archive Pages
The Blog archive pages and the Blog Main page show a different amount of posts.
To control how many posts are on the blog main page you just go to Settings > General > Reading > blog pages show at most #
How can I do the same for archived (category, months, years, tags, etc.) pages? By default my archived pages are showing 25 posts. To cut down on load time how can I change that?
This best code I have found this far is:
Code:
function limit_posts_per_archive_page() {
if ( is_category() )
$limit = 5;
elseif ( is_tag() )
$limit = 20;
else
$limit = get_option('posts_per_page');
set_query_var('posts_per_archive_page', $limit);
}
add_filter('pre_get_posts', 'limit_posts_per_archive_page');
If this is clean where and how can I implement this?