Home › Forums › Calendar Products › Events Calendar PRO › Open Event Website URLs in new window from monthly calendar view
- This topic has 6 replies, 2 voices, and was last updated 6 years, 8 months ago by Mark Mosher.
-
AuthorPosts
-
August 22, 2017 at 12:18 pm #1338706Mark MosherParticipant
Hi,
Our calendar has a mix of internal and external events:
http://honens.archwebdev.com/events/complete-calendar/?tribe-bar-date=2017-09I added a function so that from the monthly calendar view, events with an Event Website URL will link directly to that external website, as described here:
https://theeventscalendar.com/knowledgebase/make-links-event-go-straight-event-website/Now we’d like to be able to open external URLs in a new window by default. I added the filters below to our functions.php but it’s not working. The links still open in the same window.
Can you please let me know how to open external URLs in new windows from the monthly calendar view?
Thanks!
August 23, 2017 at 7:45 pm #1339481VictorKeymasterHi Mark!
Thanks for reaching out to us! I’d be happy to help you with that.
There is no straight away method to make that happen. You would have to make a template override of the single-event.php template file located at /wp-content/plugins/the-events-calendar/src/views/month/
We have a great article that will guide you on customizing our templates here > https://theeventscalendar.com/knowledgebase/themers-guide/
I hope that helps! Let me know if you have other questions.
Best,
VictorAugust 25, 2017 at 9:11 pm #1340608Mark MosherParticipantHi Victor,
I see the line in the single event template that I’d need to change but I know how to edit this so that it only opens the link in a new window if the event has an Event Website URL, NOT if it’s linking to the internal event page.
Can you share how to conditionally set the link window to new if there’s an Event Website URL entered for the event?
<div id=”tribe-events-event-<?php echo esc_attr( $event_id ); ?>” class=”<?php tribe_events_event_classes() ?>” data-tribejson='<?php echo esc_attr( tribe_events_template_data( $post ) ); ?>’>
” class=”url”><?php echo $title ?>
</div><!– #tribe-events-event-# –>
Thanks!
August 28, 2017 at 5:49 am #1341105VictorKeymasterHi Mark,
Thanks for following up with this. Let me help you with that.
First, please note that we are limited in how much support we can give for custom development questions like this. That said, we always like helping out and at least point users into the right direction.
So, I managed to come up with a template override for the single-event.php template file that will output the event website url if present. In addition to this template override you should also place some code in your theme’s functions.php file to make it open into a new tab and also show the event title.
Try the following code in here and let me know if it works for you:
https://gist.github.com/vicskf/7e50310444cc3f0591b0adcc1c71db55
Best,
VictorAugust 30, 2017 at 3:44 pm #1342760Mark MosherParticipantHi Victor,
Thanks very much for that code. Worked like a charm! We appreciate your time to help.
August 30, 2017 at 4:06 pm #1342766VictorKeymasterHi Mark!
I’m glad it worked out for you! Thanks for following up to let us know about it 🙂
I’ll close this now, but feel free to open a new thread when needed and we’d be happy to help.
Cheers,
Victor -
AuthorPosts
- The topic ‘Open Event Website URLs in new window from monthly calendar view’ is closed to new replies.