0

I'm trying to set a default image to a Customizer image with the code below but image does not display.

<img src="<?php echo get_theme_mod( 'header_image' , '<?php get_template_directory_uri(); ?>/images/default-image.jpg' ); ?>">

Am I missing something?

1 Answer 1

2

Can you try this if it will work.

<img src="<?php echo get_theme_mod( 'header_image' , get_template_directory_uri().'/images/default-image.jpg' ); ?>">
1
  • Actually, you should use header_image(). This will then automatically return the default-image as supplied when defining the custom-header theme support. So this can be as simple as: <img src="<?php header_image(); ?>">. But then you should yet again consider using the_header_image_tag() for that, but then yet again, as of 4.7 you should use the_custom_header_markup(). Commented Nov 25, 2016 at 8:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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