Created
January 18, 2015 00:37
-
-
Save ccurtin/d7c5cabd8a0ca9f82216 to your computer and use it in GitHub Desktop.
:WORDPRESS: custom action hook
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 | |
| /* | |
| *------------------------------ | |
| * CREATING A CUSTOM ACTION HOOK | |
| *------------------------------ | |
| /* | |
| 1. Create a custom action hook to load functions into | |
| ----------------------------------------------------*/ | |
| function wp_after_html() { | |
| do_action('wp_after_html'); | |
| } | |
| /* | |
| 2. Add the custom action hook into templae files | |
| ----------------------------------------------------*/ | |
| wp_after_html(); | |
| /* | |
| 3. Create a function and use th nw action to run th function there | |
| ----------------------------------------------------*/ | |
| function your_custom_action_hook_function() { | |
| // your function code here | |
| } | |
| add_action('wp_after_html', 'your_custom_action_hook_function'); | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment