Created
September 25, 2017 14:25
-
-
Save artikus11/f6d31f74bb085c7068a4f0f7af61e3fc to your computer and use it in GitHub Desktop.
Функция подстановики названия соцсетей в зависимости от сслыки на профиль
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function art_social_icons($item_url) { | |
$social_icons = apply_filters( 'art_social_icons', array( | |
'codepen.io' => 'codepen', | |
'digg.com' => 'digg', | |
'dribbble.com' => 'dribbble', | |
'dropbox.com' => 'dropbox', | |
'facebook.com' => 'facebook', | |
'flickr.com' => 'flickr', | |
'foursquare.com' => 'foursquare', | |
'plus.google.com' => 'googleplus', | |
'github.com' => 'github', | |
'instagram.com' => 'instagram', | |
'linkedin.com' => 'linkedin-alt', | |
'mailto:' => 'mail', | |
'pinterest.com' => 'pinterest-alt', | |
'getpocket.com' => 'pocket', | |
'polldaddy.com' => 'polldaddy', | |
'reddit.com' => 'reddit', | |
'skype.com' => 'skype', | |
'skype:' => 'skype', | |
'soundcloud.com' => 'cloud', | |
'spotify.com' => 'spotify', | |
'stumbleupon.com' => 'stumbleupon', | |
'tumblr.com' => 'tumblr', | |
'twitch.tv' => 'twitch', | |
'twitter.com' => 'twitter', | |
'vimeo.com' => 'vimeo', | |
'vk.com' => 'vk', | |
'wordpress.org' => 'wordpress', | |
'wordpress.com' => 'wordpress', | |
'youtube.com' => 'youtube', | |
) ); | |
$item_label = ''; | |
foreach ( $social_icons as $attr => $value ) { | |
if ( false !== strpos( $item_url, $attr ) ) { | |
$item_label = str_replace( $item_url, esc_attr( $value ), $item_url ); | |
} | |
} | |
return $item_label; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment