Home › Forums › Calendar Products › Events Calendar PRO › Exclude Category
- This topic has 5 replies, 2 voices, and was last updated 9 years, 5 months ago by Geoff.
-
AuthorPosts
-
October 8, 2014 at 10:51 am #796842Philip MurrayParticipant
hi Barry,
Following on from this thread – https://tri.be/support/forums/topic/exclude-specific-category/#post-724625
the issue i have is i want to EXCLUDE a specific category from displaying in the MONTH VIEW
is you look at this client site http://www.beaverstown.com/events/
i want all those categories to be visible but not the RESULTS categoryI know I can show the RESULTS in a calendar of it’s own by pointing directly to it but how do i EXCLUDE it from this main calendar view?
thanks
Phil
October 8, 2014 at 12:48 pm #797020GeoffMemberHi there, Phil!
Great question. Try using this snippet in yourย functions.php file to exclude events in the “Results” category from displaying in the Month View:
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'] == '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('results'), 'operator' => 'NOT IN' ) ) ); } return $query; }
If you’re looking to remove the Category label from the top of the calendar, you can do that in the CSS:
li.tribe-events-category-14 { display: none; }
Does this help answer your question? Please let me know. ๐
Cheers!
GeoffOctober 8, 2014 at 1:41 pm #797189Philip MurrayParticipantBrilliant Geoff – thanks – i will try it and let you know
PhilOctober 9, 2014 at 7:51 am #798666GeoffMemberAwesome! Keep me posted. ๐
October 17, 2014 at 8:13 am #815963GeoffMemberHey there Phil, just checking in to see if thereโs been any further update or if you still need assistance on this one–let me know. ๐
Cheers!
GeoffOctober 27, 2014 at 9:56 am #841068GeoffMemberHey there, Phil! It’s been a while so I’m going to go ahead and close this thread. If we can help with anything else, though, please don’t hesitate to create new a new thread and we’d be happy to help. ๐
Cheers!
Geoff -
AuthorPosts
- The topic ‘Exclude Category’ is closed to new replies.