WordPress.org

Support

Support » Themes and Templates » Theme Customizer API – Upload new header image

Theme Customizer API – Upload new header image

  • I’m working on a theme framework that’ll eventually be managed by secretaries and interns so I’m looking to take advantage of the new Theme Customizer as much as possible. I’m trying to enable custom headers and custom backgrounds, and everything is working perfectly except uploads of custom header images.

    The problem: uploading header images only works via the Appearance > Header screen in the admin. The ability to upload isn’t present when inside the theme customizer.

    The annoying part: uploading background images works just fine, in both places.

    Here is the code I used to enable both features:

    $args = array(
    	'flex-width'    => true,
    	'width'         => 960,
    	'flex-height'    => true,
    	'height'        => 200,
    	'default-image' => '',
    	'uploads' => true
    );
    add_theme_support( 'custom-header', $args );
    
    $defaults = array(
    	'default-color'          => '',
    	'default-image'          => '',
    	'wp-head-callback'       => '',
    	'admin-head-callback'    => '',
    	'admin-preview-callback' => ''
    );
    add_theme_support( 'custom-background', $defaults );

    And here is how the features appear in the theme customizer:

    View post on imgur.com

    As you can see, the header image doesn’t allow for a new image to be uploaded, only to pick from images previously uploaded. The custom background allows the user to upload just fine.

    Any got any idea what’s going on here?

Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Theme Customizer API – Upload new header image’ is closed to new replies.
Skip to toolbar