Created
February 19, 2016 13:02
-
-
Save chihirokaasan/ea7702db58b4fb406dfe to your computer and use it in GitHub Desktop.
Add original jQuery script to WordPress admin page.
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
function my_jquery($hook) { | |
if($hook == 'edit.php'){ | |
wp_enqueue_script('custom_admin_script', get_bloginfo('template_url').'/js/my_jquery.js', array('jquery')); | |
} | |
} | |
add_action('admin_enqueue_scripts', 'my_jquery'); | |
//jQueryでない場合、 wp_enqueue_scriptの第三引数は不要です。 |
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
(function($) { | |
$(document).ready(function(){ | |
//Write jQuery script here | |
alert('hoge'); | |
}); | |
})(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment