Home › Forums › Calendar Products › Events Calendar PRO › Event Listing excluding a category and listing showing only that category
- This topic has 7 replies, 2 voices, and was last updated 13 years ago by
Jonah.
-
AuthorPosts
-
March 22, 2013 at 10:25 am #43798
Jeff
ParticipantWe’ve created a separate page for logged in members and we want to show them a calendar with events from only one category. Then on the main site we want to exclude that category from the event list. I’ve been searching but can’t seem to find the answer! Is this possible?
Thanks for your help.
March 22, 2013 at 12:25 pm #43817Jonah
ParticipantHi Jeff,
There’s a few ways you could do this.
1. You could simply use the built in functionality for event categories that all utilize their own URL – i.e. http://yourdomain.com/events/category/category-slug/ – you would just need to figure out how people get to those pages…
2. You could modify the query using a function similar to this based upon whether a user is logged in or not: https://gist.github.com/jo-snips/2270007 – this will just affect the grid view so you would need to add another condition for list view. You’ll also want to change the arguments to include (or not include) your categories that you want to include/exclude.Does that help?
– Jonah
March 27, 2013 at 10:53 am #44196Jeff
ParticipantThat helps a lot! I am able to hide the category we don’t want from the month view, but when I change the eventDisplay to ‘list’ it doesn’t do anything. I duplicated the month view function and gave it a new name, changed ‘month’ to ‘list’. Is this the right way? Please let me know if I should be more specific.
March 27, 2013 at 2:28 pm #44214Jonah
ParticipantHi Jeff,
Sorry, I misled you. There is no eventDisplay ‘list’, only ‘past’ and ‘upcoming’. I’ve updated my gist with these args in place: https://gist.github.com/jo-snips/2270007
Let me know whether or not that works.
– Jonah
March 28, 2013 at 1:11 pm #44288Jeff
ParticipantHi Jonah,
Thanks! This works great except now it clears those events from EVER displaying. So my solution that involved the events category page no longer works. With this way in mind, is there a way to separately display just that single category (that is excluded from the main calendar). I had been using jquery to pull the div from that category page.Thanks for all your help!
March 28, 2013 at 1:26 pm #44290Jonah
ParticipantHi Jeff,
What about adding another condition to say “if we’re on this category page” don’t exclude the category, otherwise exclude it. Something like this:
if ( !is_tax( 'your_category_slug' ) && $query->query_vars['eventDisplay'] == 'upcoming' ||
$query->query_vars['eventDisplay'] == 'past' ||
$query->query_vars['eventDisplay'] == 'month' &&
$query->query_vars['post_type'] == TribeEvents::POSTTYPE &&
!is_tax(TribeEvents::TAXONOMY) &&
empty( $query->query_vars['suppress_filters'] ) ) {
That will detect to make sure you’re not on that specific event category page and modify the query as desired.Does that work?
March 28, 2013 at 1:39 pm #44292Jeff
ParticipantYes! Thanks Jonah. But the added condition should be:
!is_tax( ‘tribe_events_cat’, ‘your_category_slug’ )March 28, 2013 at 1:43 pm #44294Jonah
ParticipantAhh yes, thanks for pointing that out Jeff. So are you all set here?
– Jonah
-
AuthorPosts
- The topic ‘Event Listing excluding a category and listing showing only that category’ is closed to new replies.
