Skip to content

Instantly share code, notes, and snippets.

@vermasachin
Created February 21, 2014 15:27
Show Gist options
  • Select an option

  • Save vermasachin/9136197 to your computer and use it in GitHub Desktop.

Select an option

Save vermasachin/9136197 to your computer and use it in GitHub Desktop.
Custom Social Share Front Page
add_action( 'YOUR_HOOK_HERE', 'single_post_social_share' );
function single_post_social_share() {
if ( is_front_page() ) { ?>
<div class="social-sharer">
<div class="share-love">
<center><div class="share-text"><i class="icon-share"></i> Share it!</div></center>
</div>
<div class="share-facebook">
<center><a href="http://www.facebook.com/share.php?u=<?php print(urlencode(get_permalink())); ?>&title=<?php print(urlencode(the_title())); ?>" target="_blank"><div class="share-text"><i class="icon-facebook"></i> Share on Facebook</div></a>
</div>
<div class="share-twitter">
<center><a href="http://twitter.com/home?status=<?php print(urlencode(the_title())); ?>+<?php print(urlencode(get_permalink())); ?>" target="_blank"><div class="share-text"><i class="icon-twitter"></i> Share on Twitter</div></a></center>
</div>
<div class="share-google">
<center><a href="https://plus.google.com/share?url=<?php print(urlencode(get_permalink())); ?>" target="_blank"><div class="share-text"><i class="icon-google-plus"></i> Share on Google+</div></a></center>
</div>
</div>
<?php }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment