Change header logo on custom post type header

I have set logo in my header.php: <img src="<?php bloginfo('template_directory'); ?>/dist/images/logo.png" alt="Logo"></a>

Now in my custom post type (Customers) I need to have different logo in header. What would be best way to change logo?

It seems to be overkill to create base.php for this custom post type?
I was also thinking about to change logo with javascript in main.js, but I could not get template path inside js-file. And also thinking is that even a right way to do it.

Any help appreciated!

What about:

if ( is_singular('customer') ) { ?>
   <img src="<?php bloginfo('template_directory'); ?>/dist/images/logo-customer.png" alt="Logo Customer">
<?php } else { ?>
   <img src="<?php bloginfo('template_directory'); ?>/dist/images/logo.png" alt="Logo">
}
3 Likes

Yes, this works like a charm :slight_smile:

Definitely use get_template_directory_uri() instead of bloginfo('template_directory')

Background info: http://wordpress.stackexchange.com/a/72731

3 Likes