Last active
January 24, 2018 22:02
-
-
Save spigotdesign/06365290f3c25795f535d8a3324b83c8 to your computer and use it in GitHub Desktop.
Show all items on WordPress CPT 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
/** | |
* Show all Portfolio CPT items on archive | |
* | |
*/ | |
add_action( 'pre_get_posts', 'spigot_show_all_work' ); | |
function spigot_show_all_work( $query ) { | |
if ( ! is_admin() && $query->is_main_query() ) { | |
if ( is_post_type_archive( 'portfolio' ) ) { | |
$query->set('posts_per_page', -1 ); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment