Support

Home Forums Event Espresso Premium Opening external link in new window

Opening external link in new window

Posted: October 26, 2021 at 6:25 pm

Viewing 2 reply threads


marjorieevents

October 26, 2021 at 6:25 pm

table view events the “view details” should be new tab
I tried added this code from forum but its not working.
how can we make external link open in new window?

https://marjoriebrookseminars.com/
See this under “Upcoming Events”
The STRAIT Method™ : Scar Tissue Release – Foundations
Carlson College of Massage Therapy
April 30, 2022 8:30 am
View Details

/*New Window EE4 table*/

function espresso_venue_website( $VNU_ID = 0, $echo = TRUE ) {
$venue = EEH_Venue_View::get_venue( $VNU_ID );
if ( $venue instanceof EE_Venue ) {
$url = $venue->venue_url();
$att = array( ‘target’ => ‘_blank’ );
$link = ! empty( $url ) ? EEH_Schema::url( $url, $url, $att ) : ”;
} else {
return ”;
}
if ( $echo ) {
echo $link;
return ”;
}
return $link;
}


marjorieevents

October 26, 2021 at 6:28 pm

also how do we edit support posts on here?


Tony

  • Support Staff

October 27, 2021 at 8:08 am

Hi there,

The code you’ve linked to is related to the venue website URL and is not used in the above table.

To set the table view template to open a new tab when outputting ‘view details’ you’ll need to override the current template as it’s not an option we have available.

You can do that by copying the original template into the root directory of your theme (preferably a child theme) and changing the code used there.

So, copy \wp-content\plugins\eea-events-table-template\templates\espresso-events-table-template.template.php

Into your themes root directory, then open that copy up after line 95 add something like this:

if(!empty($external_url)) {
    $live_button 	= '<a id="a_register_link-'.$post->ID.'" class="a_register_link" href="'.$registration_url.'" target="_blank">'.$button_text.'</a>';
}

That will open the link up in another window when an external URL is used.

also how do we edit support posts on here?

You can’t, we found it caused issues where users would edit threads after support had replied and sometimes completely changed the flow of the thread, which then cause more confusion for future readers.

If there is an issue with your post we can update it for you if you let us know what it is.

Viewing 2 reply threads

The support post ‘Opening external link in new window’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso