WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to create a custom theme using Wordpress 3.4's customization options. I would like to create an option to change the theme's logo, but I would like to also display a default logo image.

I am using the following code in my function.php page:

$defaultbranding = "get_bloginfo('template_directory') . '/images/logo.png";

    $wp_customize->add_setting( 'change_branding', array(
        'default' => get_bloginfo('template_directory') . '/images/logo.png',
    ) );

    $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'change_branding', array(
        'label'   => 'Image Control',
        'section' => 'theme_settings',
        'settings'   => 'change_branding',
    ) ) );

And in the theme's header.php page:

src='<?php echo get_theme_mod( 'change_branding' , 'default' ) ?>'

I would like the 'default' value on the front end to be:

get_bloginfo('template_directory') . '/images/logo.png'

Is there some way I can achieve this?

Thanks in advance for any help.

share|improve this question
up vote 3 down vote accepted

I had the same problem a few minutes ago. Here is what I used in the src tag:

<?php if (get_theme_mod( 'custom_logo_image' )) : echo get_theme_mod( 'custom_logo_image'); else: echo get_template_directory_uri().'/inc/images/default_logo.png'; endif; ?>

It seemed to solve my problem. Let me know if it works for you.

share|improve this answer
This works great. Many thanks, Jacob! – Anthony Sep 10 '12 at 12:55

Your Answer


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.