Last active
July 5, 2023 01:28
-
-
Save oneblackcrayon/0dbccd51ff71f04064b187caa9c9fb26 to your computer and use it in GitHub Desktop.
Must Use Plugin for Woocommerce not working
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: MU Woo Snippets | |
Plugin URI: https://gist.github.com/oneblackcrayon | |
Description: | |
Version: 1.0.0 | |
Author: OneBlackCrayon | |
Author URI: https://gist.github.com/oneblackcrayon | |
License: GPLv3 | |
License URI: https://www.gnu.org/licenses/gpl-3.0.html | |
*/ | |
defined( 'ABSPATH' ) or exit; | |
// Add a class to the checkout page body tag | |
if( class_exists( 'WooCommerce' ) ){ | |
if( is_checkout() ) { | |
echo 'Testing Checkout'; | |
function obc_woocom_kadencewp_class_body_checkout() { ?> | |
<script id="obc_woocom_kadencewp_class_body_checkout"> | |
(function($){ | |
jQuery(document).ready(function($){ | |
// Plugins go here | |
$('body').addClass('content-width-normal').removeClass('content-width-fullwidth'); | |
}); | |
})(jQuery); | |
</script> | |
<?php | |
} | |
add_action('wp_footer', 'obc_woocom_kadencewp_class_body_checkout'); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: MU Woo Snippets | |
Plugin URI: https://gist.github.com/oneblackcrayon | |
Description: | |
Version: 1.0.0 | |
Author: OneBlackCrayon | |
Author URI: https://gist.github.com/oneblackcrayon | |
License: GPLv3 | |
License URI: https://www.gnu.org/licenses/gpl-3.0.html | |
*/ | |
defined( 'ABSPATH' ) or exit; | |
// Add a class to the checkout page body tag | |
function obc_woocom_kadencewp_class_body_checkout() { | |
if( class_exists( 'WooCommerce' ) && is_checkout() ){ ?> | |
<script id="obc_woocom_kadencewp_class_body_checkout"> | |
(function($){ | |
jQuery(document).ready(function($){ | |
$('body').addClass('content-width-normal').removeClass('content-width-fullwidth'); | |
}); | |
})(jQuery); | |
</script> | |
} <?php | |
} | |
add_action('wp_head', 'obc_woocom_kadencewp_class_body_checkout'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment