Home › Forums › Support › Multiple Static Frontpage / Selected Posts on Frontpage › Reply To: Multiple Static Frontpage / Selected Posts on Frontpage
December 3, 2015 at 12:15 am
#157558
Tom
Lead Developer
Lead Developer
Hi Hari,
You could add this little snippet and set it so the home page only displays posts from a specific category:
function generate_home_category( $query ) {
if ( $query->is_home() && $query->is_main_query() ) {
$query->set( 'category_name', 'home-category-slug' );
}
}
add_action( 'pre_get_posts', 'generate_home_category' );
The idea comes from here: http://wordpress.stackexchange.com/questions/159689/how-to-remove-certain-category-posts-from-the-blog-page
Let me know if you need more info 🙂