Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Joshua David Nelson

    (@joshuadnelson)

    I believe that is doable! I’m traveling at the moment, and replying via my phone, but I’ll do a little research/testing when I am back at my computer and get back to you in the next couple days.

    Cheers,
    Joshua

    Thread Starter imaginemonkey

    (@imaginemonkey)

    Awesome, thanks! Love the quick feedback, and the fact that you actually support this!

    Plugin Author Joshua David Nelson

    (@joshuadnelson)

    My pleasure! I haven’t tested this yet, but it should work. Basically using the filter already in place for the exclude page option, but utilizing the is_woocommerce conditional. Check out WooCommerce’s documentation on their built-in-conditionals (if this only occurs, for instance, on single product pages you might use is_product() instead).

    I’ve wrapped it in a function_exists just in case you deactivate WooCommerce in the future and leave Scripts-To-Footer in place, so if you decide to go with a different WooCommerce conditional, be sure to change it in both places.

    Place this in your theme’s function.php file or a custom plugin:

    function stf_exclude_on_woocommerce( $exclude_page, $post_id ) {
        if( function_exists( 'is_woocommerce' ) ) {
            if( is_woocommerce() ) {
                $exclude_page = 'on'; // this turns on the "exclude" option
            }
        }
        return $exclude_page;
    }
    add_filter( 'scripts_to_footer_exclude_page', 'stf_exclude_on_woocommerce' );

    Let me know if that doesn’t work or if you have any other issues.

    Cheers,
    Joshua

    Plugin Author Joshua David Nelson

    (@joshuadnelson)

    Were you able to get this to work for you? Let me know either way, I’ll mark as resolved if so.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Disable for WooCommerce’ is closed to new replies.