Redirect specific events to custom pages

Home Forums Calendar Products Events Calendar PRO Redirect specific events to custom pages

  • This topic has 11 replies, 2 voices, and was last updated 6 years, 1 month ago by Raymond Gillespie.
Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #1446109
    Raymond Gillespie
    Participant

    Most of our events are fine and work normally, but a few of them require a specific set of content that can’t easily be achieved with the standard event post template, and therefore have their own pages set up based on custom templates. Is there any way that, when a user clicks on the event title for these specific events, they can be redirected to the custom page in question, rather than the event post?

    #1447250
    Jennifer
    Keymaster

    Hi Raymond,

    I think your best bet here would be to edit the templates for the views that you are using. You can do this by following the instructions in our themer’s guide. So for example, if you wanted to edit the link to the single event in month view, you would want to edit the template found at wp-content/plugins/src/views/month/single-event.php. There, you will find a $link variable that is storing the link to the single event, and the following line, where the link is being output (line 196):

    " class="url">

    After you’ve copied this template into your child theme (following the instructions in our themer’s guide), you can edit the link there.

    We are a bit limited in the amount of support that we can provide for customizations, but if you get stuck or have any questions, please let me know. I will be happy to point you in the right direction!

    Thanks,

    Jennifer

    #1447370
    Raymond Gillespie
    Participant

    Hello,

    Thanks for the update, that makes sense. So in theory, we could, for example, wrap this in an if statement that produced a different type of link based on the category in question? If so, do you know which variable we can use to determine the category type?

    #1448122
    Jennifer
    Keymaster

    Sure thing! You can use the tribe_event_in_category function to check if an event has a certain category. Our functions list has several other functions like this, so I would definitely recommend this as a resource when customizing our plugins.

    #1448775
    Raymond Gillespie
    Participant

    Thanks!

    #1449248
    Raymond Gillespie
    Participant

    Hi again,

    I have almost got this sorted. However, I can’t find the template that links the image of photo mode through to the event post. I have looked in photo/single-event.php but even when I remove the link from that entirely I still have the image linking through to the event post. Should I be looking somewhere else?

    This is all based on photo mode BTW (probably should have said that sooner!)

    #1451012
    Jennifer
    Keymaster

    Hi Raymond,

    Thanks for clarifying that you’re using photo view! You can remove the link from the image by changing this line in the photo/single-event.php file:

    to

    If you want to change the link for the image, you can use the tribe_event_featured_image_link filter (see the tribe_event_featured_image function in – line 920 – in wp-content/plugins/the-events-calendar/src/functions/template-tags/general.php).

    Let me know if this helps!

    #1451029
    Raymond Gillespie
    Participant

    Ah great thanks, I think I found the filter I need:

        if ( ! empty( $featured_image ) && apply_filters( 'tribe_event_featured_image_link', $link ) ) {
            $featured_image = '<a href="' . esc_url( tribe_get_event_link( $post_id ) ) . '">' . $featured_image . '</a>';
        }
    

    Do I add this to functions.php to override the copy in the plugin folder?

    #1451707
    Raymond Gillespie
    Participant

    It’s OK, I got it sorted – I disabled the link and wrapped the whole div in the link I was using for the title – works fine now, thanks.

    #1452058
    Jennifer
    Keymaster

    Great, I’m glad to hear it’s working now!

    If there’s anything else that I can help with, please let me know 🙂

    #1472270
    Support Droid
    Keymaster

    Hey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.

    Thanks so much!
    The Events Calendar Support Team

Viewing 11 posts - 1 through 11 (of 11 total)
  • The topic ‘Redirect specific events to custom pages’ is closed to new replies.