Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1225756
    powrider686
    Participant

    Hey there,
    I’d like to add an email icon into the area where social icons go in both the top bar and footer.

    How could I add an Email (envelope) icon in both of those areas which is hyperlinked to a “mailto:”

    My site’s url is soprisprinting.wpengine.com, username: demo, password: soprisprinting

    Thank you!

    Marcus

    #1225940
    Jade
    Moderator

    Hi Marcus,

    Because this requires a template change, I’d advise that you setup a child theme. This allows you to make code changes that won’t be overwritten when an X update is released. After your child theme is setup, please review how we recommend making template changes in Customization Best Practices.

    Then add this code in the functions.php file of the child theme:

    // Social Output
    // =============================================================================
    
    if ( ! function_exists( 'x_social_global' ) ) :
      function x_social_global() {
    
        $facebook    = x_get_option( 'x_social_facebook', '' );
        $twitter     = x_get_option( 'x_social_twitter', '' );
        $google_plus = x_get_option( 'x_social_googleplus', '' );
        $linkedin    = x_get_option( 'x_social_linkedin', '' );
        $xing        = x_get_option( 'x_social_xing', '' );
        $foursquare  = x_get_option( 'x_social_foursquare', '' );
        $youtube     = x_get_option( 'x_social_youtube', '' );
        $vimeo       = x_get_option( 'x_social_vimeo', '' );
        $instagram   = x_get_option( 'x_social_instagram', '' );
        $pinterest   = x_get_option( 'x_social_pinterest', '' );
        $dribbble    = x_get_option( 'x_social_dribbble', '' );
        $flickr      = x_get_option( 'x_social_flickr', '' );
        $behance     = x_get_option( 'x_social_behance', '' );
        $tumblr      = x_get_option( 'x_social_tumblr', '' );
        $whatsapp    = x_get_option( 'x_social_whatsapp', '' );
        $soundcloud  = x_get_option( 'x_social_soundcloud', '' );
        $rss         = x_get_option( 'x_social_rss', '' );
    
        $output = '<div class="x-social-global">';
    
          if ( $facebook )    : $output .= '<a href="' . $facebook    . '" class="facebook" title="Facebook" target="_blank"><i class="x-icon-facebook-square" data-x-icon=""></i></a>'; endif;
          if ( $twitter )     : $output .= '<a href="' . $twitter     . '" class="twitter" title="Twitter" target="_blank"><i class="x-icon-twitter-square" data-x-icon=""></i></a>'; endif;
          if ( $google_plus ) : $output .= '<a href="' . $google_plus . '" class="google-plus" title="Google+" target="_blank"><i class="x-icon-google-plus-square" data-x-icon=""></i></a>'; endif;
          if ( $linkedin )    : $output .= '<a href="' . $linkedin    . '" class="linkedin" title="LinkedIn" target="_blank"><i class="x-icon-linkedin-square" data-x-icon=""></i></a>'; endif;
          if ( $xing )        : $output .= '<a href="' . $xing        . '" class="xing" title="XING" target="_blank"><i class="x-icon-xing-square" data-x-icon=""></i></a>'; endif;
          if ( $foursquare )  : $output .= '<a href="' . $foursquare  . '" class="foursquare" title="Foursquare" target="_blank"><i class="x-icon-foursquare" data-x-icon=""></i></a>'; endif;
          if ( $youtube )     : $output .= '<a href="' . $youtube     . '" class="youtube" title="YouTube" target="_blank"><i class="x-icon-youtube-square" data-x-icon=""></i></a>'; endif;
          if ( $vimeo )       : $output .= '<a href="' . $vimeo       . '" class="vimeo" title="Vimeo" target="_blank"><i class="x-icon-vimeo-square" data-x-icon=""></i></a>'; endif;
          if ( $instagram )   : $output .= '<a href="' . $instagram   . '" class="instagram" title="Instagram" target="_blank"><i class="x-icon-instagram" data-x-icon=""></i></a>'; endif;
          if ( $pinterest )   : $output .= '<a href="' . $pinterest   . '" class="pinterest" title="Pinterest" target="_blank"><i class="x-icon-pinterest-square" data-x-icon=""></i></a>'; endif;
          if ( $dribbble )    : $output .= '<a href="' . $dribbble    . '" class="dribbble" title="Dribbble" target="_blank"><i class="x-icon-dribbble" data-x-icon=""></i></a>'; endif;
          if ( $flickr )      : $output .= '<a href="' . $flickr      . '" class="flickr" title="Flickr" target="_blank"><i class="x-icon-flickr" data-x-icon=""></i></a>'; endif;
          if ( $behance )     : $output .= '<a href="' . $behance     . '" class="behance" title="Behance" target="_blank"><i class="x-icon-behance-square" data-x-icon=""></i></a>'; endif;
          if ( $tumblr )      : $output .= '<a href="' . $tumblr      . '" class="tumblr" title="Tumblr" target="_blank"><i class="x-icon-tumblr-square" data-x-icon=""></i></a>'; endif;
          if ( $whatsapp )    : $output .= '<a href="' . $whatsapp    . '" class="tumblr" title="Whatsapp" target="_blank"><i class="x-icon-whatsapp" data-x-icon=""></i></a>'; endif;
          if ( $soundcloud )  : $output .= '<a href="' . $soundcloud  . '" class="soundcloud" title="SoundCloud" target="_blank"><i class="x-icon-soundcloud" data-x-icon=""></i></a>'; endif;
          
          //
          // You can insert your custom icons here 
          //
    
          // Email
          $email = 'mailto:[email protected]';
          if ( $email )  : $output .= '<a href="' . $email . '" class="email" title="Email" target="_blank"><i class="x-icon-envelope-o" data-x-icon=""></i></a>'; endif;
    
          if ( $rss )         : $output .= '<a href="' . $rss         . '" class="rss" title="RSS" target="_blank"><i class="x-icon-rss-square" data-x-icon=""></i></a>'; endif;
    
        $output .= '</div>';
    
        echo $output;
    
      }
    endif;
    // =============================================================================

    Hope this helps.

    #1228873
    powrider686
    Participant

    Great, that did, thank you!

    Next question on it. Can we make it behave like the other social icons, so that it changes color when you hover over it?

    Thanks for the help!

    #1228880
    powrider686
    Participant

    Also, when you click on it, it opens in the same page and goes blank, along with triggering an email Can it be set to open the mailto in a new window?

    Thank you!

    #1229347
    Rupok
    Member

    Hi there,

    Thanks for writing back. You can add this under Custom > CSS in the Customizer.

    .x-social-global a.email:hover {
      background-color: #3b5998;
      color: #fff;
    }

    And it supposed to open the email client of your PC and it’s the usual behavior. There is no need to open it in new window as it’s not going to do anything on browser.

    Thanks!

    #1230425
    powrider686
    Participant

    Sweet, thanks for that.

    Maybe I wasn’t clear. When you click on it, it opens a new browser page that is blank, with mailto:[email protected] in the URL address bar. I’ve never seen a href-mailto: do that, and I would like to stop that from happening. I want it only to trigger the email client, not a new browser window that goes nowhere. How can I make it only trigger the email client?

    Thanks for the help!

    Marcus

    #1230629
    Jade
    Moderator

    Hi Marcus,

    Please remove target="_blank" the from the code on our first response from:

     $email = 'mailto:[email protected]';
          if ( $email )  : $output .= '<a href="' . $email . '" class="email" title="Email" target="_blank"><i class="x-icon-envelope-o" data-x-icon=""></i></a>'; endif;

    Hope this helps.

  • <script> jQuery(function($){ $("#no-reply-1225756 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>