Skip to content

Instantly share code, notes, and snippets.

@billerickson
Created January 1, 2012 14:51
Show Gist options
  • Save billerickson/1547518 to your computer and use it in GitHub Desktop.
Save billerickson/1547518 to your computer and use it in GitHub Desktop.
Increase post count to 20 - Right Way
<?php
add_action( 'pre_get_posts', 'be_increase_posts_on_quotes_archive' );
/**
* Increase posts on Quotes Archive
* @author Bill Erickson
* @link http://www.billerickson.net/customize-the-wordpress-query/
*
* @param object $query
*/
function be_increase_posts_on_quotes_archive( $query ) {
if( $query->is_main_query() && $query->is_post_type_archive( 'quotes' ) && !is_admin() )
$query->set( 'posts_per_page', '20' );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment