Runs in the header.php and loads in the theme header code found in /includes/theme-header.php
. This function can also be removed using remove_action() if you prefer to use your own theme header code instead.
Usage
This hook provides no parameters. You use this hook by having your function echo output to the browser, or by having it perform background tasks. Your functions shouldn’t return, and shouldn’t take any parameters.
add_action( 'appthemes_header', 'your_function' ); |
Example: Replacing Theme Header
To replace the default header, simply call remove_action() on the theme’s default header function, and then add your own.
function unhook_appthemes_functions() { // unload the default ClassiPress theme header remove_action( 'appthemes_header', 'cp_header' ); } add_action('init','unhook_appthemes_functions'); // let's add our own header instead function my_theme_header() { // do something here } add_action( 'appthemes_header', 'my_theme_header' ); |
Example: Adding an Announcement Bar
If you don’t remove the default header (or give your function a higher priority), your code will run after the default header code. While you should use the appthemes_after_header() action hook, you can get similar functionality here.
function sale_annoucement() { echo '<div class="annoucement">' . __( 'Come back July 5th for 10% off everything!', 'appthemes') . '</div>'; } add_action( 'appthemes_after_header', 'sale_annoucement' ); |
Changelog
- since 1.1
Source File
appthemes_header()
is located in includes/header.php
.