-2

I'm creating new responsive theme.

How do I get customable theme header image with text inside the image? For ie. Site title in the header image. I read about using add_theme_support( 'custom-header' ); but I can't get it to work.

Point would be that my customer got to option for change the company's header image later if needed.

1
  • I read about using add_theme_support( 'custom-header' ); but I can't get it to work Where is your code, what exactly is the issue. Please file an edit with your code and explain exactly what the issue is. Simply stating it is not working is not a valid description of a failure Commented Mar 20, 2016 at 17:56

1 Answer 1

0

Add the below code in functions.php File of your theme. It will tells your theme to support custom headers:

$defaults = array(
    'default-image'          => '',
    'width'                  => 0,
    'height'                 => 0,
    'flex-height'            => false,
    'flex-width'             => false,
    'uploads'                => true,
    'random-default'         => false,
    'header-text'            => true,
    'default-text-color'     => '',
    'wp-head-callback'       => '',
    'admin-head-callback'    => '',
    'admin-preview-callback' => '',
);
add_theme_support( 'custom-header', $defaults );

Add this in Header.php File of your theme:

<img src="<?php header_image(); ?>" height="<?php echo get_custom_header()->height; ?>" width="<?php echo get_custom_header()->width; ?>" alt="" />

Recommended : Custom Headers .

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.