Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
wordpress social sharing functions
<?php
/*
http://darkoobweb.com/?p=1700
shortcode to use: <?php echo do_shortcode('[darkoobweb_social_sharing]') ; ?>
*/
function darkoobweb_social_sharing()
{
extract(shortcode_atts(array(), $atts));
return'
<div id="social-sharing-container">
<i class="icon-share"></i> اشتراک گذاری:
<a class="social-sharing-icon social-sharing-icon-email" target="_new" href="https://t.me/share/url?url= '. wp_get_shortlink() .'"><i class="fa fa-telegram">Telegram |</i></a>
<a class="social-sharing-icon social-sharing-icon-facebook" target="_new" href="http://www.facebook.com/share.php?u=' . urlencode(wp_get_shortlink()) . '&title=' . urlencode(get_the_title()). '"><i class="fa fa-facebook"> Facebook |</i></a>
<a class="social-sharing-icon social-sharing-icon-twitter" target="_new" href="http://twitter.com/home?status='. urlencode(get_the_title()). '+'. urlencode(wp_get_shortlink()) . '+ @darkoobweb'. '"><i class="fa fa-twitter"> Twitter |</i></a>
<a class="social-sharing-icon social-sharing-icon-google-plus" target="_new" href="https://plus.google.com/share?url=' . urlencode(wp_get_shortlink()) . '"><i class="fa fa-gplus"> Google+ |</i></a>
<a class="social-sharing-icon social-sharing-icon-linkedin" target="_new" href="http://www.linkedin.com/shareArticle?mini=true&url=' . urlencode(wp_get_shortlink()) . '&title=' . urlencode(get_the_title()) . '&source=' . get_bloginfo("url") . '"><i class="fa fa-linkedin"> Linkedin |</i></a>
<a class="social-sharing-icon social-sharing-icon-email" target="_new" href="mailto:?subject=' . urlencode(get_the_permalink()) . '&body=Check out this article I came across '. wp_get_shortlink() .'"><i class="fa fa-mail"></i> Email</a>
</div>
';
}
add_shortcode("darkoobweb_social_sharing", "darkoobweb_social_sharing");
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment