Skip to content

Instantly share code, notes, and snippets.

@JiveDig
Created May 10, 2013 20:49
Show Gist options
  • Save JiveDig/5557296 to your computer and use it in GitHub Desktop.
Save JiveDig/5557296 to your computer and use it in GitHub Desktop.
// ----------------------- Set the number of a custom post type 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_post_type_archive('code') ) {
$query->set( 'posts_per_page', 24 );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment