• Resolved stjason

    (@stjason)


    This seems like an easy question to answer but I’m struggling to find the line I need to edit. I want to add a mailto: link to the <span>emailAddress</span> section in the top bar above the header.

    Any idea what I need to edit to get it added? It doesn’t seem to be an option in the customizer and I’m having a hard time finding where the top bar is generated.

    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter stjason

    (@stjason)

    I was able to solve this. The file to edit is here (use a child theme):

    Mesmerize: information.php (inc/header-options/navigation-options/top-bar/content-types/information.php)

    You can insert this code around line 149 after $text is set.

    `if(filter_var($text, FILTER_VALIDATE_EMAIL)) {
    $text = “<a href=’mailto:” . $text . “‘>” . $text . “</a>”;
    }`

    • This reply was modified 7 years, 3 months ago by stjason.

    @stjason – can you give me a little better idea where to place this in the code?

    (I’m a WP Noob so please bear with me)

    Here is the original code from lines 141 to 152:

    ———————————————-

    $can_show = mesmerize_can_show_demo_content();
    $is_enabled = get_theme_mod(“header_top_bar_{$area}_info_field_{$i}_enabled”, true);
    $icon = get_theme_mod(“header_top_bar_{$area}_info_field_{$i}_icon”, $defaults[$i][‘icon’]);
    $text = get_theme_mod(“header_top_bar_{$area}_info_field_{$i}_text”, $can_show ? $defaults[$i][‘text’] : “”);

    if ( ! intval($is_enabled)) {
    continue;
    }

    if (!$can_show && !$text) {
    continue;
    }

    ————————————————-

    Where exactly do I place: `if(filter_var($text, FILTER_VALIDATE_EMAIL)) {
    $text = “<a href=’mailto:” . $text . “‘>” . $text . “</a>”;
    }`

    Many thanks in advance!!!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Mailto: link in top bar?’ is closed to new replies.