Last active
August 29, 2015 14:16
-
-
Save aldolat/42791cc9064ceeea7944 to your computer and use it in GitHub Desktop.
Load a custom javascript in a WordPress admin page
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 | |
| /** | |
| * Load the Javascript file. | |
| * The file will be loaded only in the widgets admin page. | |
| * | |
| * @since 1.25 | |
| */ | |
| function pis_load_scripts( $hook ) { | |
| if( $hook != 'widgets.php' ) { | |
| return; | |
| } | |
| wp_enqueue_script( 'pis-js', plugins_url( 'js/pis.js', __FILE__ ), array( 'jquery', 'jquery-ui-accordion' ), PIS_VERSION, false ); | |
| } | |
| add_action( 'admin_enqueue_scripts', 'pis_load_scripts' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment