Created
August 29, 2012 15:53
-
-
Save wpsmith/3514759 to your computer and use it in GitHub Desktop.
Enqueues Appropriate Scripts when needed based on Debugging.
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_action( 'wp_enqueue_scripts', 'wps_child_script' ); | |
| /** | |
| * Enqueues Appropriate Scripts when needed based on Debugging. | |
| * Assumes that the normal *.js is the minified version & *-dev.js is beautified version. | |
| * | |
| * @uses wp_enqueue_script() WP adds JS to page safely. | |
| * @uses WP_DEBUG Constant: Triggers "debug" mode throughout WordPress | |
| * @uses WP_SCRIPT_DEBUG Constant: Forces WordPress to use the "dev" versions of core CSS and Javascript files | |
| * @uses CHILD_URL Constant: Genesis Child URL | |
| */ | |
| function wps_child_script() { | |
| $suffix = ( WP_DEBUG || WP_SCRIPT_DEBUG ) ? '-dev.js' : '.js'; | |
| wp_enqueue_script( 'my-awesome-js-1', CHILD_URL . '/js/myawesomeness1' . $suffix, array( 'jquery' ) , '1.0.0', true ); | |
| wp_enqueue_script( 'my-awesome-js-2', CHILD_URL . '/js/myawesomeness2' . $suffix, array( 'jquery' ) , '1.0.0', true ); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment