Created
May 28, 2012 18:29
-
-
Save mestrewp/2820524 to your computer and use it in GitHub Desktop.
CTP custom post per page
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 | |
// Posts per page on CPT | |
function cs_custom_posts_per_page_CPT( $query ) { | |
switch ( $query->query_vars['post_type'] ) { | |
case 'album-de-fotos': | |
$query->query_vars['posts_per_page'] = 9; | |
break; | |
case 'loja': | |
$query->query_vars['posts_per_page'] = 15; | |
break; | |
default: | |
break; | |
} | |
return $query; | |
} | |
add_filter( 'pre_get_posts', 'cs_custom_posts_per_page_CPT' ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment