"In same term" for tribe_the_next_event_link()

Home Forums Calendar Products Events Calendar PRO "In same term" for tribe_the_next_event_link()

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #965878
    Marty
    Participant

    Hi there,

    I’m using tribe_the_next_event_link() and tribe_the_prev_event_link() to make Next/Previous links on my event single pages.

    When doing a similar thing with Posts, WP core has the function next_post_link(). It has the useful param $in_same_term, which “indicates whether next post must be within the same taxonomy term as the current post.”

    Can you help me out together an example of how to extend or replace tribe_the_next_event_link() with the $in_same_term functionality? Thanks!

    Marty

    #966092
    George
    Participant

    Hey Marty,

    We unfortunately can’t help with process of writing a custom function like this from stem-to-stern, since by its nature it is a customization request outside the scope of support here, but we can definitely offer some advice and it should indeed be possible to build something like this.

    The best piece of advice I could recommend is to just head into the core WordPress code itself and look for where these functions are defined. If you do this, you’ll actually be led through a different functions until the actual function where the $in_same_term is used – it’s in the function get_adjacent_post().

    You’ll notice the argument for $taxonomy here defaults to ‘category’, so it stands to reason that if you basically duplicate the $in_same_term-related functionality here but make the taxonomy ‘tribe_events_cat’ instead, it should work similarly.

    It’s a more complicated customization to make than you might think from the outset, but head into the core code and start piecing things together – if you have a good backup of your site and content before doing so, and some time to play around with this, I’m sure you’ll be able to put something useful together.

    Let us know if this helps or if you have further questions or concerns.

    Thanks!
    George

    #966478
    Marty
    Participant

    Closing

    #966698
    George
    Participant

    Hey Marty,

    I think your last reply means that you want to close this ticket, so I will do that 🙂

    Best of luck with your customizations – reach out to us if other questions or concerns arise.

    Thanks!
    George

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘"In same term" for tribe_the_next_event_link()’ is closed to new replies.