WordPress.org

Forums

WooCommerce - excelling eCommerce
No More ShareThis: Use This (2 posts)

  1. daileycon
    Member
    Posted 1 year ago #

    After the upgrade you might be wondering where your share buttons are. ShareThis has been refractored but I just found this code and works like a charm!!
    Add this to your functions.php file.

    `
    add_action('woocommerce_share','wooshare');
    function wooshare(){
    echo'
    <div class="fb-like" data-href="'.get_permalink().'" data-layout="button_count" data-send="false" data-width="100" data-show-faces="false" style="display:inline"></div>
    <a href="https://twitter.com/share" class="twitter-share-button">Tweet</a><br><br>
    <g:plusone size="short"></g:plusone>
    <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
    <a href="http://pinterest.com/pin/create/button/?url='. urlencode(get_permalink()).'&media='.urlencode(wp_get_attachment_url( get_post_thumbnail_id() )).'&description='.apply_filters( 'woocommerce_short_description', $post->post_excerpt ).'" class="pin-it-button" count-layout="horizontal"><img border="0" src="//assets.pinterest.com/images/PinExt.png" title="Pin It" /></a>
    <script type="text/javascript" src="//assets.pinterest.com/js/pinit.js"></script>';?>
    <script type="text/javascript">
    (function() {
    var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
    po.src = 'https://apis.google.com/js/plusone.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
    })();
    </script>
    <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&appId=281787978603249";
    fjs.parentNode.insertBefore(js, fjs);
    }(document, 'script', 'facebook-jssdk'));</script>
    <?php
    }
    </code>

    https://wordpress.org/plugins/woocommerce/

  2. daileycon
    Member
    Posted 1 year ago #


    add_action('woocommerce_share','wooshare');
    function wooshare(){
    echo'
    <div class="fb-like" data-href="'.get_permalink().'" data-layout="button_count" data-send="false" data-width="100" data-show-faces="false" style="display:inline"></div>
    Tweet

    <g:plusone size="short"></g:plusone>
    <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
    post_excerpt ).'" class="pin-it-button" count-layout="horizontal"><img border="0" src="//assets.pinterest.com/images/PinExt.png" title="Pin It" />
    <script type="text/javascript" src="//assets.pinterest.com/js/pinit.js"></script>';?>
    <script type="text/javascript">
    (function() {
    var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
    po.src = 'https://apis.google.com/js/plusone.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
    })();
    </script>
    <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&appId=281787978603249";
    fjs.parentNode.insertBefore(js, fjs);
    }(document, 'script', 'facebook-jssdk'));</script>
    <?php
    }

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WooCommerce - excelling eCommerce
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.