Home › Forums › Calendar Products › Events Calendar PRO › Include events in main loop by category
- This topic has 2 replies, 3 voices, and was last updated 10 years, 1 month ago by
Support Droid.
-
AuthorPosts
-
March 21, 2016 at 12:07 pm #1091959
Neesha
ParticipantHello,
I want to include all posts and events in the category ‘featured’. This category has a different ID for posts and events, since post categories are distinct from event categories.
This is the code I tried but it doesn’t work. I’m guessing that’s because it creates an AND condition for two mutually exclusive conditions (being in a post category and an event category)? I’m using genesis framework. Each category condition works by itself but not together:
/** Replace the standard loop with our custom loop */
remove_action( ‘genesis_loop’, ‘genesis_do_loop’ );
add_action( ‘genesis_loop’, ‘child_do_custom_loop’ );function child_do_custom_loop() {
global $paged; // current paginated page
global $query_args; // grab the current wp_query() args
$args = array(
‘post_type’ => array( ‘post’, ‘tribe_events’ ), // include these post types
‘category__in’ => 6, // include posts from this category
‘tribe_event_in_category’ => ‘featured’, // include events from this category
‘paged’ => $paged, // respect pagination
);genesis_custom_loop( wp_parse_args($query_args, $args) );
}
Can you advise on a way to modify the main loop that would include only the featured post category and the featured event category?
Thank you.
March 21, 2016 at 9:10 pm #1092192Nico
MemberHi there Neesha,
Thanks for reaching out to us on this! Interesting question indeed, let’s jump into it…
I see two approaches to solve this issue, one is to enable the default post categories for events, and just use the default post category to get both. But this will surely have some side effects. The other option is to build a more complex taxonomy query that doesn’t exclude post or events like the one you sent. You can find more information about taxonomy queries here: https://codex.wordpress.org/Class_Reference/WP_Query#Taxonomy_Parameters – be sure to check out the multiple taxonomy handling example!
Please let me know if any of the two might work for you and if you need help setting those up,
Best,
NicoApril 5, 2016 at 9:35 am #1098413Support Droid
KeymasterThis topic has not been active for quite some time and will now be closed.
If you still need assistance please simply open a new topic (linking to this one if necessary)
and one of the team will be only too happy to help. -
AuthorPosts
- The topic ‘Include events in main loop by category’ is closed to new replies.
