To add a place for an action (hook) you should use this function:
do_action( 'this_is_a_place_for_a_future_added_action' );
* it can be used anywhere in your theme
To add a callback for an existing place (hook), you should use:
add( 'action', 'action or hook', 'callback' );
such as in the following example:
function hook_test() {
$markup = '<div class="widget">';
$markup .= 'This is a hook !';
$markup .= '</div>';
return $markup;
}
or the same thing using a class:
class hooks {
public static function hook_test() {
$markup = '<div class="widget">';
$markup .= 'This is a hook !';
$markup .= '</div>';
return $markup;
}
}
add( 'action', 'before_widgets_right', array( 'hooks', 'hook_test' ) );
The example is on an existing hook in our default theme, to see all existing hooks in our default theme please click here