This solution enables you to display posts from one or more categories on any page using the Genesis blog page template and exclude the same posts from displaying on your home page.
Exclude Categories From Blog Page Template
Use settings like these to exclude the categories you don’t want displayed on your blog page.
The above example shows posts from categories with the I.D of 1,2 & 3 have been excluded from displaying on any page using the blog page template in Genesis.
Home Page Categories
Now you can use PHP code in your child themes functions file to only display posts from categories categories with the I.D of 1,2 & 3.
function home_page_categories( $query ) {
if ( $query->is_home() && $query->is_main_query() && !is_admin() ) {
$query->set( 'cat', '1,2,3' );
}
}
add_action( 'pre_get_posts', 'home_page_categories' );
Leave a Reply
You must be logged in to post a comment.