Last active
June 8, 2018 06:13
-
-
Save wpmark/6e31f167c3fe6e4e411c to your computer and use it in GitHub Desktop.
Pre Get Posts to Show All Posts for Custom Post Type Archive
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 | |
function wpmark_alter_team_archive_template_query( $query ) { | |
/* only proceed on the front end */ | |
if( is_admin() ) { | |
return; | |
} | |
/* only on the person post archive for the main query */ | |
if ( $query->is_post_type_archive( 'wpmark_person' ) && $query->is_main_query() ) { | |
$query->set( 'posts_per_page', -1 ); | |
} | |
} | |
add_action( 'pre_get_posts', 'wpmark_alter_team_archive_template_query' ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment