*
* @package Superhero
* @since Superhero 1.0
*/
/**
* Setup the WordPress core custom header feature.
*
* @uses superhero_header_style()
* @uses superhero_admin_header_style()
* @uses superhero_admin_header_image()
*
* @package Superhero
*/
function superhero_custom_header_setup() {
add_theme_support( 'custom-header', apply_filters( 'superhero_custom_header_args', array(
'default-image' => '',
'default-text-color' => 'fff',
'width' => 480,
'height' => 150,
'flex-width' => true,
'flex-height' => true,
'wp-head-callback' => 'superhero_header_style',
'admin-head-callback' => 'superhero_admin_header_style',
'admin-preview-callback' => 'superhero_admin_header_image',
) ) );
}
add_action( 'after_setup_theme', 'superhero_custom_header_setup' );
if ( ! function_exists( 'superhero_header_style' ) ) :
/**
* Styles the header image and text displayed on the blog
*
* @see superhero_custom_header_setup().
*
* @since Superhero 1.0
*/
function superhero_header_style() {
// If no custom options for text are set, let's bail
// get_header_textcolor() options: HEADER_TEXTCOLOR is default, hide text (returns 'blank') or any hex value
if ( HEADER_TEXTCOLOR == get_header_textcolor() )
return;
// If we get this far, we have custom styles. Let's do this.
?>
Header admin panel.
*
* @see superhero_custom_header_setup().
*
* @since Superhero 1.0
*/
function superhero_admin_header_style() {
?>
Header admin panel.
*
* @see superhero_custom_header_setup().
*
* @since superhero 1.0
*/
function superhero_admin_header_image() {
$style = sprintf( ' style="color:#%s;"', get_header_textcolor() );
$header_image = get_header_image();
?>