Created
January 24, 2016 16:02
-
-
Save beovulf/d69663d32a919019d60e to your computer and use it in GitHub Desktop.
Set the number of posts for the custom post type
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
function set_posts_per_page_for_towns_cpt( $query ) { | |
if ( !is_admin() && $query->is_main_query() && is_post_type_archive( 'szkoa' ) ) { | |
$query->set( 'posts_per_page', '12' ); | |
} | |
} | |
add_action( 'pre_get_posts', 'set_posts_per_page_for_towns_cpt' ); | |
// set posts per page for custom post type |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment