Removing one category of events from main event list and calendar.

Home Forums Calendar Products Events Calendar PRO Removing one category of events from main event list and calendar.

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #13587
    Seth
    Participant

    I 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?

    #13596
    Rob
    Member

    Hi 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!

    #13611
    Seth
    Participant

    Yep that’s right.

    #13629
    Rob
    Member

    Alright 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.

    #13649
    Jonah
    Participant

    Hi 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!

    #14132
    Seth
    Participant

    Worked like a charm, thanks so much!

    #14134
    Jonah
    Participant

    Glad to hear Seth!

    #14135
    Seth
    Participant

    Actually, the code added to list.php seems to break the Next/Previous Events links on the page.

    #14137
    Jonah
    Participant

    Got an example I can look at?

    #14139
    Seth
    Participant

    Sure – 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

    #14141
    Jonah
    Participant

    Hey 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?

    #15868
    Jeremy
    Participant

    I’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!
    Jeremy

    #15889
    Rob
    Member

    Thanks 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.

    #975821
    Support Droid
    Keymaster

    This 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.

Viewing 14 posts - 1 through 14 (of 14 total)
  • The topic ‘Removing one category of events from main event list and calendar.’ is closed to new replies.