Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I use the custom header feature for my theme and I’d like to add an additional upload field to the Custom Header page in the backend (page=custom-header) for a custom logo upload.

I found this but the custom options aren’t saved.

Thank you for any help!

share|improve this question

1 Answer 1

I just did something similar recently. Instead of putting it on the Custom Header page, you should be adding things to the Theme Customizer (new in 3.4). It's just as easy and is a more standard way of adding new theme options.

In fact, just by having added the Custom Header, the Theme Customizer should be active on your theme already. When you click Customize, you should see the header options in there. To add a new section that allows custom logo upload, try something like this:

add_action( 'customize_register', 'themename_customize_register' );
function themename_customize_register($wp_customize) {

    $wp_customize->add_section( 'ignite_custom_logo', array(
        'title'          => 'Logo',
        'description'    => 'Display a custom logo?',
        'priority'       => 25,
    ) );

    $wp_customize->add_setting( 'custom_logo', array(
        'default'        => '',
    ) );

    $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'custom_logo', array(
        'label'   => 'Custom logo',
        'section' => 'ignite_custom_logo',
        'settings'   => 'custom_logo',
    ) ) );
}

That code will give you a new box in the Theme Customizer, like so:

Theme Customizer logo upload

share|improve this answer
    
PS: Otto has a great write-up about using the Theme Customizer: ottopress.com/2012/… –  clark Nov 3 '12 at 17:25
    
Thank you very much, already tested it! :) –  user1706680 Nov 5 '12 at 21:13
    
Glad it worked! Mind picked it as the correct answer? (to help others find it) –  clark Nov 7 '12 at 21:06

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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