-
Notifications
You must be signed in to change notification settings - Fork 0
[Basics] Actions
Plugin/theme can add hooks that the WordPress core launches at specific points during execution, using the Action API. For some events, you can use class methods.
The plugin/theme does not need to add action to the init and admin_init events - you just need to override the methods with such names and perform the necessary initializations in them. Within these methods, you can safely refer to options helpers.
public function init() {
if($this->is_option('add_category')) {
register_taxonomy_for_object_type('category', 'attachment');
}
}
public function admin_init() {
if(!session_id()) session_start();
}It is also possible to override methods for loading scripts that are bound to the wp_enqueue_scripts and admin_enqueue_scripts events - but this is strongly discouraged. To work with scripts, it is better to use the mechanisms that are described in detail in the Scripts & Styles.
Usually translations are loaded with a hook that is bound to the after_setup_theme event. This is done inside the framework and you can customize work with translations by following the instructions from Translations.
Zukit - The Developer Framework for WordPress