Custom Header is a WordPress theme feature introduced with Version 2.1. Custom header is an image that is chosen as the representative image in the theme top header section. To use this feature, it must be activated in the theme with `add_theme_support`.
The custom header is a WordPress theme feature introduced with Version 2.1. Custom header is an image that is chosen as the representative image in the theme top header section.
Since Version 3.4, themes need to use
add_theme_support() in the
functions.php file to support custom headers, like so:
add_theme_support( 'custom-header' );
You must register the header image before it can be used as a default in your theme. Also, you can add default arguments using:
$defaults = array( 'default-image' => '', 'random-default' => false, 'width' => 0, 'height' => 0, 'flex-height' => false, 'flex-width' => false, 'default-text-color' => '', 'header-text' => true, 'uploads' => true, 'wp-head-callback' => '', 'admin-head-callback' => '', 'admin-preview-callback' => '', 'video' => false, 'video-active-callback' => 'is_front_page', ); add_theme_support( 'custom-header', $defaults );
The theme may also include a custom callback function that changes the effect of the feature.