1

I am making a web site (a theme) in WordPress with logo which is not located in header area, but bellow header, on front-page.php (home page) instead. Is there any way to allow user to upload custom logo image instead of the current one?

I've seen many tutorials on how to do allow custom header logo upload, but the problem is, my logo is, as I said, on the page area below header area.

0

If I read your question well, you already use WordPress Custom Logo, but you want a different logo on your front page. This means you will need to upload a separate image.

Assuming you already know how to use the customizer in general you will need to build an upload field like this:

$wp_customize->add_control( 
    new WP_Customize_Upload_Control( 
    $wp_customize, 
    'wpse238690_front_logo', 
    array(
        'label'       => __( 'First image', 'wpse215632_theme' ),
        'description' => __( 'More about first image', 'wpse215632_theme' ),
        'section'     => 'wpse238690__section_id',
        'settings'    => 'wpse238690__setting_id',
    ) ) 
);

Replace the section and setting to fit the control in the right place in your customizer system.

In your header template you must then include a conditional with is_front_page: display the normal logo in the header if you're not on the front page. In your front page template include the logo with get_mod('wpse238690_front_logo').

  • You are right, I am using WordPress Custom Logo. Will this code make my custom logo image show where I need it? Can I upload this code to functions.php? Excuse my questions, I am a newbie. – Nancy Sep 9 '16 at 9:18
  • Logos will show in the place where you include them in your template. It will not happen automatically. – cjbj Sep 9 '16 at 9:24
  • Understood. I did as you instructed and it works. Thank you for your time and help! – Nancy Sep 9 '16 at 9:28

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.