Home › Forums › Calendar Products › Events Calendar PRO › Add Event Website URL to Tooltip
- This topic has 19 replies, 4 voices, and was last updated 8 years, 11 months ago by
Kevin.
-
AuthorPosts
-
April 7, 2017 at 3:11 pm #1266817
Kevin
ParticipantI am trying to add buttons to the tooltips in the month view of my calendar. One button is going to the event page ( I am using View Event Page to link to the corresponding event).
The button I am having trouble with is linking to the “Event Website URL” from the tooltip. I tried using: ‘>View Event Website URL. This seems to work at some times, but not at others. Is there another tag (like [[=permalink]]) that I can use in the tooltip to go to the url that is entered in the Event Website URL?
I did find this: https://gist.github.com/bordoni/439bd58bbfbb7db3454b, but it is for adding the venue in the tooltip, not the event website URL.
Can you please let me know a tag I can use in tooltip.php that will grab that event website URL?
Thanks
April 7, 2017 at 3:17 pm #1266822Kevin
ParticipantIt looks like the code in my post was converted, so I am wrapping my question in code here:
I am trying to add buttons to the tooltips in the month view of my calendar. One button is going to the event page ( I am using <a href='[[=permalink]]'>View Event Page</a> to link to the corresponding event). The button I am having trouble with is linking to the "Event Website URL" from the tooltip. I tried using: <a href='<?php echo esc_url( tribe_get_event_website_url() ); ?>'>View Event Website URL</a>. This seems to work at some times, but not at others. Is there another tag (like [[=permalink]]) that I can use in the tooltip to go to the url that is entered in the Event Website URL? I did find this: https://gist.github.com/bordoni/439bd58bbfbb7db3454b, but it is for adding the venue in the tooltip, not the event website URL. Can you please let me know a tag I can use in tooltip.php that will grab that event website URL? ThanksApril 11, 2017 at 8:26 pm #1268658Shelby
ParticipantHi Kevin,
I’m happy to help you out with this. Sounds like you’re trying to make some pretty cool changes! 🙂 Can you try ‘tribe_get_event_website_link’ instead of ‘tribe_get_event_website_url’ for me and let me know if that changes anything for you? If not, I’ll reach out to another member of my team. 🙂
Thanks!
Shelby 🙂
April 13, 2017 at 9:25 am #1269502Kevin
ParticipantHi Shelby,
Thanks for the response. Unfortunately, that is not working for me. tribe_get_event_website_url is working for me in the other calendar views (list, photo), but for some reason it does not pass on in the tooltip. Can you please look into another solution? I have a feeling we are going to need something similar to [[=title]] but for the Event Website URL.
Thanks!
April 14, 2017 at 12:17 pm #1270248Brook
ParticipantHowdy Kevin,
Shelby reached out to me and asked if I had any ideas.
Since this is working for you at some times and not others, a couple of things come to mind. Have you enabled Month View Cache in WP-Admin > Events > Settings > Display? If so, the cache will likely contain the old version of this template. You could disable the cache while you are doing your development then reenable it once the look is finalized.
Second, there are two templates within the tooltip.php theme override you have created, one for featured events and one for regular events. Did you add your variable in both places? If you only added it in one then these changes will not appear everywhere.
Does one of those sound like they might be the culprit? If not, can you confirm that you definitely can get the URL to appear at times, but it intermittently fails?
Thank you Kevin!
– Brook
April 14, 2017 at 6:59 pm #1270337Kevin
ParticipantHi Brook,
Thanks for the response.
The cache was not enabled, so that was not the issue.
We are not using featured events so I don’t believe it would be pulling a different tooltip template.
I am getting a URL to pass through, but it is weirdly pulling the “Event Website URL” for the furthest event out. We have events entered until June and it is linking the last event in June. What is weird is that the link works fine in all the other views, but not in the tooltip view.Thanks for looking into it.
Kevin
April 17, 2017 at 7:26 pm #1270908Shelby
ParticipantHi Kevin,
I’m going to check in with Brook and see if he has any more ideas about this one. 🙂
In the meantime, have you, by chance followed the steps here to test for conflicts with themes and plugins? This might reveal where the issue is rooted.
Cheers!
Shelby 🙂
April 20, 2017 at 12:05 pm #1272347Kevin
ParticipantHi Shelby,
Just checking in to see if there is any update with this? I did try the steps to test conflicts, but that did not seem to be the issue? Any update would be appreciated.
Thanks,
Kevin
April 20, 2017 at 3:45 pm #1272419Mathew
ParticipantKevin,
You’re so close to having all the pieces to the puzzle. From what Shelby mentioned, to Gustavo’s GIST, it’s a matter of putting it all together.
Here’s what I have used for a customer.
* If you are using Gustavo’s GIST, then inject lines 3-9 of the following into it. If your not using it, then insert the entire function into your custom functions.php.
function additional_tooltip_fields( $json, $event, $additional ){
//important to deal with empty values
$json['event_website'] = '';// make the magic happen
$url = tribe_get_event_website_link( $event );
if ( $url ) {
$json['event_website'] = tribe_get_event_website_url( $url );
}return $json;
}
add_filter( 'tribe_events_template_data_array', 'additional_tooltip_fields', 10, 3 );
Now edit tooltips.php and insert the following in between the script divs where you want it positioned and displayed. If you are using the latest version of TEC, there’s now two scripts in tooltips.php. Add this to both script sections.
[[ if(event_website.length) { ]]
<div class="tribe-events-event-url">Event Website: View Website</div>
[[ } ]]
Hope this helps.
April 20, 2017 at 3:57 pm #1272425Mathew
ParticipantThe syntax highlighter played havoc with the brackets. Here’s an image of what the tooltips.php edit should look like.
April 20, 2017 at 4:06 pm #1272426Mathew
ParticipantKevin,
You’re so close to having all the pieces to the puzzle. From what Shelby mentioned, to Gustavo’s GIST, it’s a matter of putting it all together.
Here’s what I have used for a customer.
* If you are using Gustavo’s GIST, then inject lines 3-9 of the following into it. If your not using it, then insert the entire function into your custom functions.php.
function additional_tooltip_fields( $json, $event, $additional ){ //important to deal with empty values $json['event_website'] = ''; // make the magic happen $url = tribe_get_event_website_link( $event ); if ( $url ) { $json['event_website'] = tribe_get_event_website_url( $url ); } return $json; } add_filter( 'tribe_events_template_data_array', 'additional_tooltip_fields', 10, 3 );Now edit tooltips.php and insert the above code in between the script divs where you want it positioned and displayed. If you are using the latest version of TEC, there’s now two scripts in tooltips.php. Add this to both script sections.
Hope this helps.
April 21, 2017 at 5:21 pm #1272937Kevin
ParticipantHi Mathew,
Thank you so much, that worked! Thank you!
My last remaining problem is that I am having trouble getting the cursor to get into the tooltip to click the link. When I move the cursor from the event title in the calendar, the tooltip goes away before I can get my cursor into it. If I move really fast, I can get it to work but was wondering if you had any way to fix this? Basically I need to improve how the hover of the mouse gets to the tooltip box.
Thanks!
May 2, 2017 at 11:20 am #1277549Kevin
ParticipantIt’s been awhile since I heard back so just checking in to see if you saw my question in the last post.
Thanks
May 6, 2017 at 3:36 pm #1279915Shelby
ParticipantHi Kevin,
Somehow this slipped through my radar! Apologies for that. Can you let me know what browser you’re using where you’re experiencing this?
Best,
Shelby 🙂
May 9, 2017 at 10:06 am #1281058Kevin
ParticipantHi Shelby,
I am seeing this happen in Chrome (58), Firefox (53), and Safari. It seems to be on all browsers I can test.
Thanks,
Kevin
-
AuthorPosts
- The topic ‘Add Event Website URL to Tooltip’ is closed to new replies.
