WordPress.org

Ready to get started?Download WordPress

Forums

Theme Customizer API - Upload new header image (8 posts)

  1. clarklab
    Member
    Posted 1 year ago #

    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:

    http://i.imgur.com/e4G2F.png

    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?

  2. esmi
    Forum Moderator
    Posted 1 year ago #

    The ability to upload isn't present when inside the theme customizer.

    Correct. Bear in mind that the Theme Customizer is still in its infancy, so may not have all of the features that you expected.

    Have you reviewed:
    http://ottopress.com/2012/how-to-leverage-the-theme-customizer-in-your-own-themes/
    http://ottopress.com/2012/theme-customizer-part-deux-getting-rid-of-options-pages/

  3. clarklab
    Member
    Posted 1 year ago #

    But, but... the backgrounds upload just fine. I've also made my own settings section with an image upload contained. Will I need to avoid the 'core' header feature and write my own? The only difference is the admin screen will disappear, which I wanted to hide anyway.

    I guess I'm just confused why image uploads work everywhere but the header. Is it the cropping?

  4. Bill Erickson
    Member
    Posted 1 year ago #

    Here's the relevant ticket: http://core.trac.wordpress.org/ticket/21355

    It looks like header upload WAS in the customizer, but because cropping wasn't there it couldn't enforce the header dimensions. It was pulled in 3.4.2, and will hopefully be added back in 3.5 with cropping.

  5. clarklab
    Member
    Posted 1 year ago #

    My timing is always impeccable.

  6. juliedc
    Member
    Posted 1 year ago #

    Just upgraded to 3.5 today and now I can upload a header image but it won't appear. Css looks fine. Site with no logo - yikes. Can anyone point me to where I can find a fix?

  7. WPyogi
    Volunteer Moderator
    Posted 1 year ago #

    @juliedc, per the forum guidelines, if you need help, you should start your own thread rather than tacking on to an old one. Especially since your issue is totally different given that is is a 3.5 upgrade problem.

  8. juliedc
    Member
    Posted 1 year ago #

    ok, will do

Topic Closed

This topic has been closed to new replies.

About this Topic