I’m having a little difficult getting links from custom shortcodes to display in the same way as links created by default shortcodes. I am using the default template and the links that are created via the standard shortcodes are working fine – they display as links with the correct formatting. However the Zoom link that I am inserting (see code below) sometimes displays as a hyperlink and sometimes (I am testing each time with a fully URL) not and never with the styling applied. Is there something obvious that needs to happen? Many thanks in advance for any help
function register_new_tony_shortcodes( $shortcodes, EE_Shortcodes $lib ) {
//Add a shortcode to be used with the EE Datetimes within messages
if ( $lib instanceof EE_Datetime_Shortcodes ) {
$shortcodes['[ZOOM_LINK]'] = _('Zoom Link Shortcode');
}
return $shortcodes;
}
add_filter( 'FHEE__EE_Shortcodes__shortcodes', 'register_new_tony_shortcodes', 10, 2 );
function register_new_tony_shortcodes_parser( $parsed, $shortcode, $data, $extra_data, EE_Shortcodes $lib ) {
//Check for the datetime shortcodes and that the $data is the expected object (in this case an EE_Datetime)
if ( $lib instanceof EE_Datetime_Shortcodes && $data instanceof EE_Datetime ) {
if ( $shortcode == '[ZOOM_LINK]' ) {
$event = $data->event();
if ( $event instanceof EE_Event ) {
$evt_id = $event->ID();
}
if ( !empty( $evt_id ) ) {
$event_external_booking_group = get_field( 'event_external_booking', $evt_id );
if( $event_external_booking_group['zoom_link'] ){
$zoom_link = '<a href="'.$event_external_booking_group['zoom_link'].'" />'.$event_external_booking_group['zoom_link'].'</a>';
return $zoom_link ;
}
}
}
}
//If conditions above not met return the currently parsed content.
return $parsed;
}
add_filter( 'FHEE__EE_Shortcodes__parser_after', 'register_new_tony_shortcodes_parser', 10, 5 );
The /> for the opening tag is incorrect and basically ‘self closes’ the opening a tag. When I send an email using that syntax, this is how the email is parsed (by the mailserver/client):
The support post ‘Link from custom shortcode in email template not displaying as expected’ 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.
Support forum for Event Espresso 3 and Event Espresso 4.