Created
December 22, 2016 00:04
-
-
Save braddalton/7fcad29eed213dc454396f9278493dd6 to your computer and use it in GitHub Desktop.
Posts Per Page For CPT Archive http://wpsites.net/wordpress-tips/set-different-amount-of-posts-per-page-for-each-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
add_action( 'pre_get_posts', 'portfolio_items' ); | |
function portfolio_items( $query ) { | |
if( $query->is_main_query() && !is_admin() && is_post_type_archive( 'portfolio' ) ) { | |
$query->set( 'posts_per_page', '12' ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment