Last active
September 10, 2015 04:01
-
-
Save nutsandbolts/77845882dfadaf72f7eb to your computer and use it in GitHub Desktop.
Daily Bolt: increase posts per page
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 12 posts per page | |
add_action( 'pre_get_posts', 'nabm_change_posts_per_page' ); | |
function nabm_change_posts_per_page( $query ) { | |
if ( ! $query->is_main_query() || is_admin() || is_feed() ) { | |
return $query; | |
} | |
if ( is_front_page() ) { | |
$query->set( 'posts_per_page', 12 ); | |
} | |
return $query; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment