Skip to content

Instantly share code, notes, and snippets.

@anneallen
Created March 17, 2014 18:25
Show Gist options
  • Save anneallen/9605275 to your computer and use it in GitHub Desktop.
Save anneallen/9605275 to your computer and use it in GitHub Desktop.
Social share buttons for genesis
add_action( 'genesis_entry_content', 'child_share_buttons',6);
function child_share_buttons (){
$return_string .='<ul class="share_buttons">';
$return_string .= '<li>
<a href="https://twitter.com/share" class="twitter-share-button" data-count="none">Tweet</a> </li>
<li class="fb">
<div class="fb-share-button" data-href="http://developers.facebook.com/docs/plugins/" data-type="button"></div>
</li>
<li>
<a href="//www.pinterest.com/pin/create/button/" data-pin-do="buttonBookmark" ><img src="//assets.pinterest.com/images/pidgets/pinit_fg_en_rect_gray_20.png" /></a>
</li>
</ul><div style="clear:both"></div>';
echo $return_string;
}
/*** And don't forget to to add the js to the footer*/
/*Twitter*/<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
/*Facebook*/
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
/*Pinterest*/
<!-- Please call pinit.js only once per page -->
<script type="text/javascript" async src="//assets.pinterest.com/js/pinit.js"></script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment