Last active
August 29, 2015 14:16
-
-
Save eri-trabiccolo/f0c9e74fcf0e496ec543 to your computer and use it in GitHub Desktop.
show two posts without pagination in home
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', 'show_two_posts_in_home'); | |
function show_two_posts_in_home($query){ | |
if ( ! is_admin() && $query -> is_main_query() && tc__f('__is_home') && ! tc__f('__is_home_empty') ){ | |
$query->set('posts_per_page', 2); | |
// remove pagination | |
add_filter('tc_show_post_navigation', '__return_false', 999); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment