-
-
Save GaryJones/1547745 to your computer and use it in GitHub Desktop.
Increase post count to 20 - Right Way
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 WP_Query $query | |
*/ | |
function be_increase_posts_on_quotes_archive( WP_Query $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