-
Notifications
You must be signed in to change notification settings - Fork 1
Actions
Actions are a core part of WordPress development that allow plugins to hook the execution of code to specific contexts in the running of WordPress or a plugin, such that the code is executed when the context arises.
WP-Librarian contains a very limited range of actions as they only started being added around Spring 2015. Actions are slowly being added to appropriate places but please feel free to pester me via email if you want some actions added to particular parts of the plugin.
The two other reasons slowing addition of actions are:
- Adding new actions requires writing up a whole documentation page. I have little free time between uni work as it is to work on coding WP-Librarian so adding/documenting actions eats into that time.
- WP-Librarian is still in Alpha release, so many parts of it are subject to great change. I don't want to waste my time adding and documenting a actions only to then depreciate it a few months later.
For using an event to modify a stream of data check out Filters.
###Dashboard Actions
Actions called from the AJAX classes, which handle loading Library Dashboard pages, performing Dash actions and Dash API requests.
wp_lib_dash_action
Called on all Dash Actions, which are AJAX requests from the Dashboard to modify the library in some way (such as loaning an item)
wp_lib_dash_action_
Called from a specific Dash Action based on the text after the last underscore. Allows you to modify the behaviour of a specific Dash Action.
wp_lib_dash_page
Called when loading any Dash Page. A Dash Page is a dynamically loaded page on the Dashboard, such as the 'Managing Item' page.
wp_lib_dash_page_
Called from a request to load a specific Dash Page based on the text after the last underscore. Allows you to add/override a specific Dash Page's content.
wp_lib_dash_api
Called when processing every Dash API requests. These handle fetching data or modifying the library in some way (such as dynamically displaying the selected member's metabox when loaning an item).
wp_lib_dash_api_
Called when processing a specific Dash API request. This plugin's Dev Kit uses this hook to create and delete fixture data.
###Template Actions
Actions that relate to front-end post templates
wp_lib_display_item_meta
Call this action to display an Item's meta box. This is the box you see on the front-end with ISBN/author information.
###Library Actions
Actions called when loan/returning items and other similar behaviour
wp_lib_loan_created
Called after a Loan has been created, which occurs when scheduling a loan or loaning an Item but not when giving an Item.
wp_lib_fine_created
Called after a Fine has been created, which occurs if an Item has been returned late and the librarian explicitly chooses to fine the Member.
###Asset Actions
Actions called in relation to the handling of scripts and styles
wp_lib_register_scripts
Called after WP-Librarian has registered all its scripts/styles
wp_lib_admin_enqueue_scripts
Called before WP-Librarian enqueues its scripts/styles for the admin-end.
wp_lib_enqueue_scripts
Called before WP-Librarian enqueues its scripts/styles for the front-end.
###Settings Actions
Actions called when loading the settings page or processing settings updates
wp_lib_settings_page
Called when loading the plugin's settings page. This hook can be used to enqueue custom scripts/styles. Potentially to be used with a custom settings tab
###Miscellaneous Actions
Actions that I can't decide how to categorise.
wp_lib_loaded
Called very early on to give plugins access to WP-Librarian core class WP_Librarian.
####1. Post Types
Items
Members
Loans
Fines
####2. Taxonomies
Author
Media Type
####3. User Roles
Librarian
Library Admin
####4. Filters
####5. Actions
####6. Releases
6.1 Alpha Releases
Fox Paw
Wolf Tail
Badger Claw
Coyote Snout