Skip to content

Instantly share code, notes, and snippets.

@stuartduff
Last active August 29, 2015 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stuartduff/23e4c543153e27a27573 to your computer and use it in GitHub Desktop.
Save stuartduff/23e4c543153e27a27573 to your computer and use it in GitHub Desktop.
Projects Posts Per Page
function custom_projects_posts_per_page( $query ) {
if ( is_admin() || ! $query->is_main_query() )
return;
if ( is_post_type_archive( 'project' ) || is_tax( 'project-category' ) ) {
// Display all posts for a custom post type called 'project'
$query->set( 'posts_per_page', -1 );
return;
}
}
add_action( 'pre_get_posts', 'custom_projects_posts_per_page', 1 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment