Created
September 23, 2011 19:29
-
-
Save billerickson/1238229 to your computer and use it in GitHub Desktop.
Change Posts Per Page for Event Archive
This file contains 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_change_event_posts_per_page' ); | |
/** | |
* Change Posts Per Page for Event Archive | |
* | |
* @author Bill Erickson | |
* @link http://www.billerickson.net/customize-the-wordpress-query/ | |
* @param object $query data | |
* | |
*/ | |
function be_change_event_posts_per_page( $query ) { | |
if( $query->is_main_query() && !is_admin() && is_post_type_archive( 'event' ) ) { | |
$query->set( 'posts_per_page', '18' ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is a perfect solution for me, but it removes my pagination template_part. Any suggestions?