Plugin: add_action event question
-
WP Version: 3.0.1
Context: Custom PluginI have tried several searches to find more info on this subject and cannot find any enlightening information on this topic. So any information to help educate me on this topic would be appreciated!
I am looking at code written in several plugins and have come across these add_action –> action hooks, and have no idea what exactly they do.
-
admin_print_styles-post.php
admin_print_scripts-post-new.php
admin_print_scripts-page.php
admin_print_scripts-page-new.phpQuestions:
1. How do these differ from the non-extension hook names ie; ( no ‘.php’ extension )?2. My assumption is you are listening to when a script is executed during a specific event cycle within the admin panel. So, my guess is once that script executes the hook you assign it would fire. Am I close at all?
Example usage:
add_action( "admin_print_scripts-post.php", array($this, 'enqueue_script') ); function enqueue_script() { wp_enqueue_script( 'tinymce4dt', WP_PLUGIN_URL . '/' . FB_DT_BASEDIR . '/js/script.js', array('jquery') ); }
- The topic ‘Plugin: add_action event question’ is closed to new replies.