Found this code snippet to change header logo front page of wordpress by adding to header.php file.
If (is_front() || is_home) {
//Your logo for the front page
}Else {
// Your other logo
}
How can I get something like this to call different logo for different Wordpress page ID's?
This is my themes call for the logo presently:
<div class="logo">
<?php $log_url = sh_set( $options, 'site_logo', get_template_directory_uri().'/images/logo.png' );
$log_url = ( $log_url ) ? $log_url : get_template_directory_uri().'/images/logo.png';
$logo_size = @getimagesize($log_url); //printr($logo_size); ?>
<a title="<?php echo esc_attr(get_bloginfo('name')); ?>" href="<?php echo esc_url(home_url()); ?>">
<img src="<?php echo esc_url($log_url); ?>" alt="<?php echo esc_attr(get_bloginfo('name')); ?>" width="<?php echo sh_set( $logo_size, 0); ?>" height="<?php echo sh_set( $logo_size, 1); ?>" >
</a>
</div>
And I should be able to add this call tag is_page( array( 42, 54, 6 ) ) to it to add a different logo to just those pages, just don't know how.
</div>
First Solution:
Very simplest way to do different logo for different page in WordPress by using header.php
<?php
$logo_default = 'get_template_directory_uri().'/images/logo_default.png'';
$logo_about = 'get_template_directory_uri().'/images/logo_about.png'';
$logo_team = 'get_template_directory_uri().'/images/logo_team.png'';
if (is_page('about-us')) {
$logo_about;
} elseif (is_page('team')) {
$logo_team;
}else{
$logo_default;
}
?>
Another solution:
<?php
$logo = 'default_logo';
if (is_page('about-us')) {
$logo = 'about_logo';
} elseif (is_page('team')) {
$logo = 'team_logo';
}
?>
Assuming you have about_logo.png logo for about-us page , team_logo.png for team page and default logo default_logo.png
<img src="/images/logo<?php echo $logo; ?>.png">
FOR CSS YOU CAN TRY THIS
.page-id-13072 .logo a {
background: url(images/logopink.png) no-repeat;
}