Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
My override functions for sharethis products in woocommerce
function woocommerce_sharethis_script() {
if (get_option('woocommerce_sharethis')) :
if (is_ssl()) :
$sharethis = 'https://ws.sharethis.com/button/buttons.js';
else :
$sharethis = 'http://w.sharethis.com/button/buttons.js';
endif;
echo '<script type="text/javascript">var switchTo5x=true;</script>
<script type="text/javascript" src="'.$sharethis.'"></script>
<script type="text/javascript">stLight.options({publisher:"'.get_option('woocommerce_sharethis').'"});</script>'
endif;
}
function woocommerce_template_single_sharing( $post, $_product ) {
if (get_option('woocommerce_sharethis')) :
echo '
<div class="social">
<span class="st_facebook_button" displayText="Facebook"></span>
<span class="st_twitter_button" displayText="Tweet"></span>
<span class="st_plusone_button"></span>
</div>';
add_action( 'wp_footer', 'woocommerce_sharethis_script' );
endif;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.