Add Event Website URL to Tooltip

Home Forums Calendar Products Events Calendar PRO Add Event Website URL to Tooltip

Viewing 15 posts - 1 through 15 (of 19 total)
  • Author
    Posts
  • #1266817
    Kevin
    Participant

    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 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

    #1266822
    Kevin
    Participant

    It 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?
    
    Thanks  
    #1268658
    Shelby
    Participant

    Hi 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 🙂

    #1269502
    Kevin
    Participant

    Hi 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!

    #1270248
    Brook
    Participant

    Howdy 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

    #1270337
    Kevin
    Participant

    Hi 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

    #1270908
    Shelby
    Participant

    Hi 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 🙂

    #1272347
    Kevin
    Participant

    Hi 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

    #1272419
    Mathew
    Participant

    Kevin,

    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.

    #1272425
    Mathew
    Participant

    The syntax highlighter played havoc with the brackets. Here’s an image of what the tooltips.php edit should look like.

    #1272426
    Mathew
    Participant

    Kevin,

    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.

    #1272937
    Kevin
    Participant

    Hi 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!

    #1277549
    Kevin
    Participant

    It’s been awhile since I heard back so just checking in to see if you saw my question in the last post.

    Thanks

    #1279915
    Shelby
    Participant

    Hi 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 🙂

    #1281058
    Kevin
    Participant

    Hi 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

Viewing 15 posts - 1 through 15 (of 19 total)
  • The topic ‘Add Event Website URL to Tooltip’ is closed to new replies.