Home › Forums › Calendar Products › Events Calendar PRO › Removing one category of events from main event list and calendar.
- This topic has 13 replies, 5 voices, and was last updated 10 years, 9 months ago by
Support Droid.
-
AuthorPosts
-
January 18, 2012 at 2:23 pm #13587
Seth
ParticipantI want to remove all events from one category from my main calendar and events list. However, I still want the specific category calendar and event list to work. Any ideas?
January 18, 2012 at 6:57 pm #13596Rob
MemberHi Seth. So just to be clear: you want these to be hidden on the grid/list view, but still accessible via clicking into a category directly? Not sure what this would entail but I can get Jonah to take a look and see if there are any quick hacks you can use to make this happen…just confirm with me on the above so we’re not going down the wrong path from the getgo. Thanks!
January 19, 2012 at 6:15 am #13611Seth
ParticipantYep that’s right.
January 19, 2012 at 10:48 am #13629Rob
MemberAlright thanks. I’m not sure how doable that is but I’ll let someone more dev-minded than I respond 🙂 Jonah has this in his round of threads for today so hopefully we’ll have a response for you here shortly.
January 19, 2012 at 1:01 pm #13649Jonah
ParticipantHi Seth, this is doable but it’s going to require a fair amount of template edits.
First make copies of wp-content/plugins/the-events-calendar/views/table.php and wp-content/plugins/the-events-calendar/views/list.php and place them into an ‘events’ folder in your them.
For table.php find line 20 that currently has:
$eventPosts = tribe_get_events(array( 'eventDisplay'=>'month' ));
…and modify that to:
$eventPosts = tribe_get_events(array(
'eventDisplay'=>'month',
'tax_query'=>array(
array(
'taxonomy' => 'tribe_events_cat',
'field' => 'id',
'terms' => 4,
'operator' => 'NOT IN'
)
)
));
Replacing ‘4’ with the ID of your events category you want to exclude. Just browse your events categories in the admin and hover over their name to get the tag_ID.
For the list, open up list.php and before the line that reads:
if (have_posts()) :
Copy and paste the following: http://pastebin.com/PPLCicug
That should do it!
January 25, 2012 at 2:31 pm #14132Seth
ParticipantWorked like a charm, thanks so much!
January 25, 2012 at 2:32 pm #14134Jonah
ParticipantGlad to hear Seth!
January 25, 2012 at 2:35 pm #14135Seth
ParticipantActually, the code added to list.php seems to break the Next/Previous Events links on the page.
January 25, 2012 at 2:37 pm #14137Jonah
ParticipantGot an example I can look at?
January 25, 2012 at 2:42 pm #14139Seth
ParticipantSure – http://www.dmu.edu/calendar/upcoming/
I also made sure this wasn’t due to my custom template list.php. I tried the code with the default list.php and no luck.
If I remove the code (http://pastebin.com/PPLCicug) from list.php the Next/Previous links come back.
Here is my full list.php if you need to view that – http://pastebin.com/PXQc8yFn
January 25, 2012 at 3:00 pm #14141Jonah
ParticipantHey Seth, I wonder if this is because not that you’re excluding a category from your list you do not have enough events to display the prev/next links?
February 28, 2012 at 10:35 am #15868Jeremy
ParticipantI’ve tried this on my site and found the same thing as Seth – the table code works great but the list code removes pagination from the query for some reason. All results instead show on one page. I think for my purposes we’ll be fine without the filter on the list and will only be using it on the table so it’s no issue and I won’t have time to pursue causes but I wanted to throw on some feedback.
Thanks for the code, Jonah!
JeremyFebruary 28, 2012 at 5:04 pm #15889Rob
MemberThanks for the heads up, Jeremy. Looks like this is something we’ll need to address in a future release so that folks in your position don’t have to hack at it.
July 5, 2015 at 5:00 pm #975821Support 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 ‘Removing one category of events from main event list and calendar.’ is closed to new replies.
