Events excluded from calendar appearing in next/previous links

Home Forums Calendar Products Events Calendar PRO Events excluded from calendar appearing in next/previous links

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #50293
    Jeff
    Participant

    After successfully hiding one of the event categories from the calendar ( https://tri.be/support/forums/topic/event-listing-excluding-a-category-and-listing-showing-only-that-category/#post-44290 ) we’ve discovered that those same excluded events are still showing up as next/previous events from single event pages. Do these next/previous links use a different query than the calendar? How can we exclude a particular category from the next/previous links also?

    Thanks!

    #50365
    Barry
    Member

    If you take a look in the-events-calendar/lib/the-events-calendar.class.php in the get_event_link() function you can see how the previous/next event link queries are formed.

    You could use this as the foundation of your own query and include a check for the excluded category – or if you prefer to keep some of that logic in PHP form then you could have a loop where each subsequent event before or after the current one is loaded until you find one that isn’t assigned to an excluded category (or until there are no more events left … note this second approach would likely be less efficient than a single query).

    I hope that gives you some ideas – it would be great to see what you come up with 🙂

    #50668
    Jeff
    Participant

    Hey Barry, thanks for your help! It seems like I could just add a line to the query that says something like “AND $wpdb->term_taxonomy.term_id NOT IN (’35’)” where 35 is the tag_id for the category I would like to exclude. That’s not working though and I’m getting no results. I’m afraid I’m a little out of my depth here, but perhaps you can shed some more light!

    #50676
    Barry
    Member

    Hi Jeff – remember that you would also need to make sure the term_taxonomy table is referenced from your FROM clause or a JOIN clause (probably a JOIN clause in this case).

    I’m afraid we can’t spend too much time on custom work like this, however. Building bespoke functionality and customizing the calendar in new and exciting ways is of course your job – but I do wish you luck and it would be great to see your final solution 🙂

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Events excluded from calendar appearing in next/previous links’ is closed to new replies.