• Resolved noski2009

    (@noski2009)


    Hi,

    I’m in the middle of building a website that needs two different logos to load on different pages.

    My current code works fine for main logo, I’m guessing that I need if and an else statement?

    <div id="header-logo" onclick="location.href='<?php bloginfo('url'); ?>'" style="cursor: pointer;" >
      <img src="<?php bloginfo('stylesheet_directory'); ?>/images/mainLogo.jpg" alt="<?php bloginfo('name'); ?>" />
    </div>

    Thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • <div id="header-logo" onclick="location.href='<?php bloginfo('url'); ?>'" style="cursor: pointer;" >
    <?php if( is_page('Foo') ) $logo_image = 'altLogo.jpg';
    else $logo_image = 'mainLogo.jpg;?>
    <img src="<?php bloginfo('stylesheet_directory'); ?>/images/<?php echo $logo_image;?>" alt="<?php bloginfo('name'); ?>" />
    </div>
    Thread Starter noski2009

    (@noski2009)

    cool thanks esmi, can I also change the if( is_page('Foo') to

    if (is_page(array('Foo', 'Foo-page-1', 'Foo-page-2', and so on?

    Thread Starter noski2009

    (@noski2009)

    Sorry for being a pain but I also got a

    Parse error: syntax error, unexpected T_STRING

    on line four of your code?
    thanks

    Thread Starter noski2009

    (@noski2009)

    It’s ok I found the error missing ‘ at else $logo_image = 'mainLogo.jpg;?>

    Second question I figured out my self, code for anyone else who’s stuck is:

    <div id="header-logo" onclick="location.href='<?php bloginfo('url'); ?>'" style="cursor: pointer;" >
    <?php if (is_page(array('page-1', 'page-2', 'page-3','page-4', 'page-5', 'page-6', 'page-7'))) $logo_image = 'second-logo.jpg';
    else $logo_image = 'mainLogo.jpg';?>
    <img src="<?php bloginfo('stylesheet_directory'); ?>/images/<?php echo $logo_image;?>" alt="<?php bloginfo('name'); ?>" />
    </div>
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Different logo on a different page’ is closed to new replies.