Make the Email Clickable in the More Info Section

If you’d like to make the email address clickable in the more info section, then you need to use the wpsl_more_info_template filter. This filter enables you to make changes to the more info template without editing the core files.

The code below shows the default template code that’s used to create the more info section. The only difference is that the email address is now wrapped in a mailto link on line 21.

add_filter( 'wpsl_more_info_template', 'custom_more_info_template' );

function custom_more_info_template() {
    
    global $wpsl;
    
    $more_info_template = '<% if ( !_.isEmpty( phone ) || !_.isEmpty( fax ) || !_.isEmpty( email ) ) { %>' . "\r\n";
    $more_info_template .= '<p><a class="wpsl-store-details wpsl-store-listing" href="#wpsl-id-<%= id %>">' . esc_html( $wpsl->i18n->get_translation( 'more_label', __( 'More info', 'wpsl' ) ) ) . '</a></p>' . "\r\n";
    $more_info_template .= '<div id="wpsl-id-<%= id %>" class="wpsl-more-info-listings">' . "\r\n";
    $more_info_template .= '<% if ( description ) { %>' . "\r\n";
    $more_info_template .= '<%= description %>' . "\r\n";
    $more_info_template .= '<% } %>' . "\r\n";
    $more_info_template .= '<p>' . "\r\n";
    $more_info_template .= '<% if ( phone ) { %>' . "\r\n";
    $more_info_template .= '<span><strong>' . esc_html( $wpsl->i18n->get_translation( 'phone_label', __( 'Phone', 'wpsl' ) ) ) . '</strong>: <%= formatPhoneNumber( phone ) %></span>' . "\r\n";
    $more_info_template .= '<% } %>' . "\r\n";
    $more_info_template .= '<% if ( fax ) { %>' . "\r\n";
    $more_info_template .= '<span><strong>' . esc_html( $wpsl->i18n->get_translation( 'fax_label', __( 'Fax', 'wpsl' ) ) ) . '</strong>: <%= fax %></span>' . "\r\n";
    $more_info_template .= '<% } %>' . "\r\n";
    $more_info_template .= '<% if ( email ) { %>' . "\r\n";
    $more_info_template .= '<span><strong>' . esc_html( $wpsl->i18n->get_translation( 'email_label', __( 'Email', 'wpsl' ) ) ) . '</strong>: <a href="mailto:<%= email %>"><%= email %></a></span>' . "\r\n";
    $more_info_template .= '<% } %>' . "\r\n";
    $more_info_template .= '</p>' . "\r\n";
    
    $more_info_template .= '</div>' . "\r\n"; 
    $more_info_template .= '<% } %>' . "\r\n";
    
    return $more_info_template;
}

Copy the above code and place it in the functions.php inside your active theme folder. Reload the store locator page, and locations that have an email address set will now show a clickable email address in the more info section.

If it doesn’t work after reloading the page, make sure to flush the cache from any possible caching plugins, your browser cache, and the WPSL transient cache on the WPSL settings page.