JiveDig
5/10/2013 - 8:40 PM

Set the number of posts per page (post count). Must be in functions.php

Set the number of posts per page (post count). Must be in functions.php

// Set the number of posts per page
add_filter( 'pre_get_posts', 'be_archive_query' );
// @link http://www.billerickson.net/customize-the-wordpress-query/
function be_archive_query( $query ) {
	if( $query->is_main_query() && $query->is_archive() ) {
		$query->set( 'posts_per_page', 12 );
	}
}

// OR

If you don't want the change to affect backend
// Set the number of posts per page
add_filter( 'pre_get_posts', 'mwm_resource_affiliate_archive_query' );
// @link http://www.billerickson.net/customize-the-wordpress-query/
function mwm_resource_affiliate_archive_query( $query ) {
	if ( ! is_admin() AND ( is_post_type_archive('resource') OR is_post_type_archive('affiliate') ) ) {
		$query->set( 'posts_per_page', 15 );
	}
}