Skip to content

Instantly share code, notes, and snippets.

@ccurtin
Created January 18, 2015 00:37
Show Gist options
  • Select an option

  • Save ccurtin/d7c5cabd8a0ca9f82216 to your computer and use it in GitHub Desktop.

Select an option

Save ccurtin/d7c5cabd8a0ca9f82216 to your computer and use it in GitHub Desktop.
:WORDPRESS: custom action hook
<?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