• Is it possible to change your logo (in the header) based on the page that is shown?
    I would like to have one logo for my homepage and another one for all the other pages.

    Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • @nikeo has very kindly provided classes to help you!

    .home = front page
    .blog = posts page
    .page = other pages
    .page-id-n = specific pages.

    So
    .home .brand a{background: url(/wp-content/uploads/NAMEOFFILE.png) repeat fixed 0 0;}
    is your Front Page logo
    .page .brand a{background: url(/wp-content/uploads/NAMEOFFILE.png) repeat fixed 0 0;}
    is other pages

    Thread Starter Elkevdh

    (@elkevdh)

    Great! Thanks! : )

    In testing this, I need to add something to remove the original Logo. Will post when I’ve solved it.

    Thread Starter Elkevdh

    (@elkevdh)

    I noticed it too, when I tried it.
    Hope you get it solved.

    Yes, it’s possible. Assuming your logo is located @ “/wp-content/uploads/NAMEOFFILE.png” and the alternatives are:
    “/wp-content/uploads/alternative_1.png”,
    “/wp-content/uploads/alternative_2.png”,
    “/wp-content/uploads/alternative_3.png”, etc…
    add this in your child theme’s functions.php:

    add_filter('tc_logo_title_display', 'my_logo_title_display');
    function my_logo_title_display($output);
    $default_logo_location = '/wp-content/uploads/NAMEOFFILE.png';
    if (is_page(array('XXX')))
    	return preg_replace('|'.preg_quote($default_logo_location,'|' ).'|', '/wp-content/uploads/alternative_1.png', $output);
    elseif (is_page(array('YYY')))
    	return preg_replace('|'.preg_quote($default_logo_location,'|' ).'|', '/wp-content/uploads/alternative_2.png', $output);
    elseif (is_page(array('ZZZ', 'WWW')))
    	return preg_replace('|'.preg_quote($default_logo_location,'|' ).'|', '/wp-content/uploads/alternative_3.png', $output);
    else return $output;

    where you need to replace XXX, YYY, ZZZ and WWW with actual id’s of the pages where you want the logo changed and, of course, the actual links to each logo for each case.

    I explained a principle, you could use any WP Conditional tags instead of is_page() and adapt it for some categories, taxonomies, custom post types, tag pages, search results, whatever suits your specific needs.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Different logo on different pages’ is closed to new replies.