Skip to content

Instantly share code, notes, and snippets.

@yanknudtskov
Created August 5, 2014 10:19
Show Gist options
  • Save yanknudtskov/5d62a6798c6143c1f48f to your computer and use it in GitHub Desktop.
Save yanknudtskov/5d62a6798c6143c1f48f to your computer and use it in GitHub Desktop.
Enqueue IRIS in WordPress editor
<?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