Created
June 3, 2014 15:30
-
-
Save justinstern/e83f91be2d6b1d36c179 to your computer and use it in GitHub Desktop.
Custom WooCommerce shortcodes class loading https://www.skyverge.com/blog/how-to-override-woocommerce-template-files/
This file contains hidden or 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 | |
// add the following to the bottom of your functions.php | |
// assumes a copy of the core class-wc-shortcodes.php, customized, is available at path/to/custom/class-wc-shortcodes.php | |
add_action( 'woocommerce_loaded', 'use_custom_wc_shortcodes' ); | |
function use_custom_wc_shortcodes() { | |
// load our custom shortcodes class | |
include_once( 'path/to/custom/class-wc-shortcodes.php' ); | |
// unhook the standard woocommerce one | |
remove_action( 'init', array( 'WC_Shortcodes', 'init' ) ); | |
// hook in ours | |
add_action( 'init', array( 'WC_Custom_Shortcodes', 'init' ) ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This code does not work