Skip to content

Instantly share code, notes, and snippets.

@davebonds
Created March 26, 2014 23:56
Show Gist options
  • Save davebonds/9796626 to your computer and use it in GitHub Desktop.
Save davebonds/9796626 to your computer and use it in GitHub Desktop.
Change Posts Per Page for Listing Archive
add_action( 'pre_get_posts', 'ae_change_listing_posts_per_page' );
/**
* Change Posts Per Page for Listing Archive
*/
function ae_change_listing_posts_per_page( $query ) {
if( $query->is_main_query() && !is_admin() && is_post_type_archive( 'listing' ) ) {
$query->set( 'posts_per_page', '18' );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment