Different Logo on each page -wordpress

10,317

Instead of using css you can make use of wordpress condition tags . Locate the php file which has the logo image usually it is header.php

<?php
    $logo_img = 'default'; 
    if (is_page('about-us')) {
        $logo_img = 'logo1'; 
    } elseif (is_page('team')) {
        $logo_img = 'logo2'; 
    } 
?>

Assuming you have logo1.png logo for about-us page , logo2.png for team page and default logo is default.png.

<img src="/images/logo<?php echo $logo_img; ?>.png">

for css only you can try

 .page-id-13072 .logo a {

   background: url(images/logopink.png) no-repeat; 
 }
Share:
10,317
user1426583
Author by

user1426583

Updated on June 04, 2022

Comments

  • user1426583
    user1426583 almost 2 years

    I'm trying to use a different Logo on each of my Wordpress pages. I have tried adding this to my css file, but the old logo is still showing underneath it:

    .page-id-13072 .full-center #logo.has-img a > img {
        position: inherit !important;
        left: 0;
        top: 100px;
        width: 450px;
        z-index: 99;
        max-width: 100%;
        background: url(http:///LogoPink.png) no-repeat;
        }