|
if( ! function_exists('prefix_share_icons')): |
|
/** |
|
* Display share icons |
|
*/ |
|
function prefix_share_icons(){ |
|
$share_string = '<a class="share-icon" href="%1$s" title="' . '%2$s' . '" onclick="%3$s">%4$s<span class="hidden">%2$s</span></a>' ; |
|
|
|
$share_facebook = sprintf($share_string, |
|
'https://www.facebook.com/sharer/sharer.php?u=' . get_the_permalink() , |
|
_x('Share on Facebook', 'mytextdomain') , |
|
'window.open(this.href, \'facebook-share\',\'width=580,height=296\');return false;', |
|
'<i class="fa fa-facebook"></i>'); |
|
|
|
$share_twitter = sprintf($share_string, |
|
'https://twitter.com/share?text='. htmlspecialchars(urlencode(html_entity_decode(get_the_title(), ENT_COMPAT, 'UTF-8')), ENT_COMPAT, 'UTF-8') .'&url='. get_the_permalink(), |
|
_x('Share on Twitter', 'mytextdomain'), |
|
'window.open(this.href, \'twitter-share\', \'width=550,height=235\');return false;', |
|
'<i class="fa fa-twitter"></i>'); |
|
|
|
$share_googleplus = sprintf($share_string, |
|
'https://plus.google.com/share?url=' . get_the_permalink() , |
|
_x('Share on Google+', 'mytextdomain') , |
|
'window.open(this.href, \'google-plus-share\', \'width=490,height=530\');return false;', |
|
'<i class="fa fa-google-plus"></i>'); |
|
|
|
|
|
echo '<div class="entry-share">' . $share_facebook . $share_twitter . $share_googleplus . '</div>'; |
|
} |
|
endif; |