Created
August 5, 2014 10:19
-
-
Save yanknudtskov/5d62a6798c6143c1f48f to your computer and use it in GitHub Desktop.
Enqueue IRIS in WordPress editor
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 | |
function load_mc_iris() { | |
if (wp_script_is( 'iris', 'enqueued' )) { | |
return; // if it's already enqueued, don't enqueue it again. | |
} else { // since it's NOT enqueued, let's enqueue it | |
wp_enqueue_script( | |
'iris', //iris.js handle | |
admin_url( 'js/iris.min.js' ), //path to wordpress iris file | |
array( 'jquery-ui-draggable', 'jquery-ui-slider', 'jquery-touch-punch' ), //these must load BEFORE iris (i.e. "dependencies) | |
false, // don't load it in the footer | |
1 // priority | |
); | |
} | |
} | |
// add this only on the backend | |
add_action( 'admin_enqueue_scripts', 'load_mc_iris' ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment