Hi!
I currently have masonry style posts pulling in specific categories on one page in my site. I’d like to duplicate that function on another page but pull in a different category of posts. Below is the code that I’m using in my child theme functions.php:
// =============================================================================
// Pull Specific Categories into Masonry Style Blog Index
// =============================================================================
function my_post_queries( $query ) {
// only homepage and is the main query
if ($query->is_home() && $query->is_main_query()){
// display only posts in category with id=48
$query->set(‘cat’, 48);
}
}
add_action( ‘pre_get_posts’, ‘my_post_queries’ );
// END
// =============================================================================
I’m not sure what part of this calls out the page that it’s connected to. I’ll post the links where this appears now and to where I also want to use this style for you in a private message.
Would you be able to help me adjust this code to make that happen?
Thanks!