Skip to content

Instantly share code, notes, and snippets.

@robneu
Created December 12, 2012 08:20
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save robneu/4266046 to your computer and use it in GitHub Desktop.
Save robneu/4266046 to your computer and use it in GitHub Desktop.
AddThis social buttons on Genesis. A little hacky, but works for right now.
<?php
/** Display Social Buttons on single post page */
add_action( 'genesis_before_post_content', 'add_social_buttons' );
add_action( 'genesis_after_post_content', 'add_social_buttons' );
function add_social_buttons() {
if ( is_single() ) {
?>
<!-- AddThis Button BEGIN -->
<div class="addthis_toolbox addthis_default_style ">
<a class="addthis_button_facebook_like" fb:like:layout="button_count"></a>
<a class="addthis_button_tweet"></a>
<a class="addthis_button_google_plusone" g:plusone:size="medium"></a>
<a class="addthis_button_pinterest_pinit"></a>
<a class="addthis_counter addthis_pill_style"></a>
</div>
<!-- AddThis Button END -->
<?php
}
}
/** Display Social Buttons on single post page */
add_action( 'wp_footer', 'add_social_script' );
function add_social_script() {
if ( is_single() ) {
?>
<script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=xa-50c2d9e171cd60e7#async=1"></script>
<?php
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment