Last active
August 29, 2015 14:17
-
-
Save eri-trabiccolo/bc9ea3bead612a37a25a to your computer and use it in GitHub Desktop.
show two selected posts in blog 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_selected_posts_in_home_blog'); | |
function show_two_selected_posts_in_home_blog($query){ | |
if ( ! is_admin() && $query -> is_main_query() && is_home() && 'posts' == get_option('show_on_front') ){ | |
$query->set('post__in', array(183, 94) ); //put your post IDs in that array | |
$query->set('ignore_sticky_posts', 1 ); //don't show sticky posts | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment