This must be easy enough, but I'm a noob so go easy on me, please :-)
I have two pieces of code and they're working well on their own. All I need is to put these two conditions into one query.
The first one:
<?php
function childtheme_cat_limited_blog( $query ) {
if ( $query->is_home() && $query->is_main_query() ) {
$query->set( 'events_categories', 'mycategory1' );
}
}
add_action( 'pre_get_posts', 'childtheme_cat_limited_blog' );
?>
And the second:
<?php
function childtheme_cat_limited_blog( $query ) {
if ( $query->is_home() && $query->is_main_query() ) {
$query->set( 'category_name', 'mycategory2' );
}
}
add_action( 'pre_get_posts', 'childtheme_cat_limited_blog' );
?>
I'm sure it's a piece a cake for you guys, but I can't figure it out for the life of me, so any help would be greatly appreciated!
Thank you!
(My goal is here to display posts from two categories on a homepage of a Wordpress site, but to complicate things the two categories are from two different post types.)