• Resolved btees

    (@btees)


    I’m trying to reduce the load time of my homepage.

    I don’t use any of the share buttons on pages, only on products. Is it possible to wrap something in a if ( is_product() ){} to make the scripts only load on products. Or is there a reason for the scripts to load on pages that don’t have share buttons?

Viewing 1 replies (of 1 total)
  • Plugin Contributor Leland

    (@addthisleland)

    Hi @btees!

    This is possible to do in 2 primary ways but will require you to install the AddThis script manually and not use the plugin.

    1.) You could write a conditional script so that our script is only initialized if the product page is loading.

    2.) Install the AddThis script just to your product page template. Since every theme names their product template differently, I wouldn’t know the exact name of your product template but below is the general instruction you can use to guide you on how to install AddThis manually.

    1.) Deactivate all AddThis plugins
    2.) Hover over Appearance –> Editor –> PRODUCT-TEMPLATE.php (the name might be different in your theme)
    3.) Scroll to the very bottom
    4.) Insert this code (you will need to insert your own Profile ID to replace “PUBID” in the below code):
    <script type=”text/javascript” src=”//s7.addthis.com/js/300/addthis_widget.js#pubid=PUBID”></script>
    5.) Save the changes to that file

    Let me know if you have any questions!

    Thanks,
    Leland

Viewing 1 replies (of 1 total)

The topic ‘Remove scripts on pages without buttons?’ is closed to new replies.