Home › Forums › Calendar Products › Events Calendar PRO › Exclude one category from Event List View
- This topic has 9 replies, 5 voices, and was last updated 11 years, 8 months ago by Jonah.
-
AuthorPosts
-
August 24, 2012 at 4:28 pm #24088Beth AveyParticipant
I would like to be able to exclude one category from the Event List View.
The site — http://hardinchamber.com/events/I would like to take one Category of events for our organization and highlight them in a separate page. In doing this, I’d also like to eliminate them from showing up in the main feed.
Thanks for any help you can offer!
WayneAugust 25, 2012 at 12:10 am #24100Joyce GraceMemberHi Wayne,
I think the easiest way to do this would be to just link to the categories directly using WordPress menus or whatever way you’re directing users to those pages.That being said, if you’d rather do some on-hand coding, here are tutorials that may help you:
https://theeventscalendar.com/list-categories-above-calendar-view-for-quick-frontend-filtering/
Actually, there are tons of tutorials that may help you here: https://theeventscalendar.com/the-events-calendar-for-wordpress-tutorials/
Let me know if you find something that works!
We also have technical documentation here: https://theeventscalendar.com/support/documentation
August 27, 2012 at 6:14 am #24142Beth AveyParticipantThank you, Joyce – the tutorial links are great and will give me good direction on linking to the distinct category “feed.” However, I’m still not seeing how to exclude a category from the main events feed (Events List View). Any help on this …?Thanks!
August 28, 2012 at 12:49 am #24171Joyce GraceMemberHi Wayne, unfortunately you’ll need to do some code hacking to customize this. We don’t really support customizations here on this forum 🙁 I was hoping the documentation pages would be able to give you something.
That being said, let me see if one of the higher level support reps can provide a quick fix for this – no guarantees though.
August 28, 2012 at 6:22 am #24190MarcParticipantI need the exact same thing. Would be happy to customize the appropriate php file or create a CSS hack, but just need some guidance.
August 28, 2012 at 9:29 am #24227Beth AveyParticipantThanks Joyce – I appreciate your responsiveness! Will await any further direction …
Best wishes,
WayneAugust 28, 2012 at 8:00 pm #24269BarryMemberHi Wayne! it might be worth taking a look at this thread:
https://theeventscalendar.com/support/forums/topic/make-a-specific-calendarcatagory-private/
And Daniel’s solution in particular (towards the end of that thread). I hope that helps!
August 29, 2012 at 6:27 am #24275Beth AveyParticipantMany thanks, Barry! I’ll try it and add any further comment there in that thread.
Peace
WayneAugust 29, 2012 at 7:09 am #24276BarryMemberNo problem, I hope that gets you on track 🙂
August 29, 2012 at 11:03 am #24295JonahParticipantHi Wayne/Marc,
You’ll want to use pre_get_posts for this. Here’s a snippet that should do what you need, just modify the category slug to your category:
add_action( 'pre_get_posts', 'exclude_events_category' );
function exclude_events_category( $query ) {if ( $query->query_vars['eventDisplay'] == 'upcoming' && !is_tax(TribeEvents::TAXONOMY) || $query->query_vars['eventDisplay'] == 'past' && !is_tax(TribeEvents::TAXONOMY) && $query->query_vars['eventDisplay'] != 'month' && $query->query_vars['post_type'] == TribeEvents::POSTTYPE && !is_tax(TribeEvents::TAXONOMY) && empty( $query->query_vars['suppress_filters'] ) ) {
$query->set( 'tax_query', array(
array(
'taxonomy' => TribeEvents::TAXONOMY,
'field' => 'slug',
'terms' => array('2012'),
'operator' => 'NOT IN'
)
)
);
}return $query;
}
I hope that helps but let me know if you need anything else.– Jonah
-
AuthorPosts
- The topic ‘Exclude one category from Event List View’ is closed to new replies.