|  | <?php | 
        
          |  | /** | 
        
          |  | * Socials | 
        
          |  | * | 
        
          |  | * @package      CoreFunctionality | 
        
          |  | * @author       Bill Erickson | 
        
          |  | * @since        1.0.0 | 
        
          |  | * @license      GPL-2.0+ | 
        
          |  | **/ | 
        
          |  | /** | 
        
          |  | * Social Links | 
        
          |  | * Uses Social URLs specified in Yoast SEO. See SEO > Social | 
        
          |  | * | 
        
          |  | */ | 
        
          |  | function ea_social_links_shortcode() { | 
        
          |  | $options = array( | 
        
          |  | 'facebook' 		=> array( | 
        
          |  | 'key' 		=> 'facebook_site', | 
        
          |  | 'icon' 		=> '<svg class="icon icon-instagram"><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#icon-instagram"></use></svg>', | 
        
          |  | ), | 
        
          |  | 'instagram' 	=> array( | 
        
          |  | 'key' 		=> 'instagram_url', | 
        
          |  | 'icon' 		=> '<svg class="icon icon-facebook"><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#icon-facebook"></use></svg>', | 
        
          |  | ), | 
        
          |  | 'youtube' 		=> array( | 
        
          |  | 'key' 		=> 'youtube_url', | 
        
          |  | 'icon' 		=> '<svg class="icon icon-youtube"><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#icon-youtube"></use></svg>', | 
        
          |  | ), | 
        
          |  | 'twitter' 		=> array( | 
        
          |  | 'key' 		=> 'twitter_site', | 
        
          |  | 'prepend' 	=> 'https://twitter.com/', | 
        
          |  | 'icon' 		=> '<svg class="icon icon-twitter"><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#icon-twitter"></use></svg>', | 
        
          |  | ), | 
        
          |  | 'linkedin' 		=> array( | 
        
          |  | 'key' 		=> 'linkedin_url', | 
        
          |  | 'icon' 		=> '<svg class="icon icon-linkedin"><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#icon-linkedin"></use></svg>', | 
        
          |  | ), | 
        
          |  | 'myspace' 		=> array( | 
        
          |  | 'key' 		=> 'myspace_url', | 
        
          |  | 'icon' 		=> '<svg class="icon icon-myspace"><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#icon-myspace"></use></svg>', | 
        
          |  | ), | 
        
          |  | 'pinterest' 	=> array( | 
        
          |  | 'key' 		=> 'pinterest_url', | 
        
          |  | 'icon' 		=> '<svg class="icon icon-pinterest"><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#icon-pinterest"></use></svg>', | 
        
          |  | ), | 
        
          |  | 'googleplus' 	=> array( | 
        
          |  | 'key' 		=> 'google_plus_url', | 
        
          |  | 'icon' 		=> '<svg class="icon icon-googleplus"><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#icon-googleplus"></use></svg>', | 
        
          |  | ) | 
        
          |  | ); | 
        
          |  | $options = apply_filters( 'ea_social_link_options', $options ); | 
        
          |  | $output = array(); | 
        
          |  | $seo_data = get_option( 'wpseo_social' ); | 
        
          |  | foreach( $options as $social => $settings ) { | 
        
          |  | $url = !empty( $seo_data[ $settings['key'] ] ) ? $seo_data[ $settings['key'] ] : false; | 
        
          |  | if( !empty( $url ) && !empty( $settings['prepend'] ) ) | 
        
          |  | $url = $settings['prepend'] . $url; | 
        
          |  | if( $url && !empty( $settings['icon'] ) ) | 
        
          |  | $output[] = '<a href="' . esc_url_raw( $url ) . '">' . $settings['icon'] . '<span class="screen-reader-text">' . $social . '</span></a>'; | 
        
          |  | } | 
        
          |  | if( !empty( $output ) ) | 
        
          |  | return '<div class="social-links">' . join( ' ', $output ) . '</div>'; | 
        
          |  | } | 
        
          |  | add_shortcode( 'social_links', 'ea_social_links_shortcode' ); |