1

I am using this to get custom header support to my new theme:

function my_add_header_support() {
    $ch_defaults = array(
                         'default-text-color'     => '',
                         'default-image'          => '',
                         );
    add_theme_support( 'custom-header', $ch_defaults );
}
add_action( 'after_setup_theme', 'my_add_header_support' );

I expected a headers section to show up under Appearance - Customize in the dashboard, but it does not. There is a previous post about the same problem (theme development - add_theme_support( 'custom-header' ) does not add option menu in dashboard - WordPress Development Stack Exchange). I think it says that support for this should show up in WP 3.4.

What am I missing?

2

From the array above, I think you just left out "uploads". And if you're wanting to be able to upload headers in the admin panel, it's good to include the "width" and "height" in the array as well.

$chargs = array(
    'width' => 980,
    'height' => 60,
    'default-text-color' => '',
    'default-image' => '',
    'uploads' => true,
);
add_theme_support( 'custom-header', $chargs );
  • Thanks Courtney. I am still struggling to understand why it did not work to begin with. Maybe I just did something stupid instead of what I thought I was doing? ;-) -- Yes, I surely want "uploads", but isn't that default? (See wp-includes/theme.php.) – Leo Mar 23 '14 at 17:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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