WordPress.org

Ready to get started?Download WordPress

Forums

Problem changing header img on a different page. (4 posts)

  1. kandik
    Member
    Posted 2 years ago #

    Hello

    I was trying to create a page with a different header when I came across this code i could not understand. Im using WordPress 3.3.1 and UpStartBlogger Modicus 2-Colum 0.3 Theme. The website is http://www.tallinnlooks.com

    This is the code from header.php:

    [Code moderated as per the Forum Rules. The maximum number of lines of code that you can post in these forums is ten lines. Please use the pastebin]

    I am trying to add a code there that should show a different header on the page "test".I used the following code:

    if(is_page('test')){
    echo '<img src="http://74.220.219.67/~mappee/tallinnlooks/wp-content/uploads/2011/02/tallinn-looks-logo-white.jpg" />';
    }

    But it does not show properly.
    I am guessing there is something wrong with <a href=""></a> being outside of php code??? When i tried to change that the website didnt display properly. When i wrote that code into the original header code it worked and changed the "test" page header, but then the homepage header dissapeared.

    Could someone please help and point out what i am doing wrong?

  2. esmi
    Theme Diva & Forum Moderator
    Posted 2 years ago #

  3. Gerald@wpcustoms
    Member
    Posted 2 years ago #

    make sure to adjust your main header image here: <img src="your-other-header-img.jpg" />:

    <div id="header">
    <?php if(is_page('test')){ ?>
    <a href="<?php bloginfo('url'); ?>" title="<?php bloginfo('name'); ?>">
    <img src="http://74.220.219.67/~mappee/tallinnlooks/wp-content/uploads/2011/02/tallinn-looks-logo-white.jpg" />
    <?php } else { ?>
    <a href="<?php bloginfo('url'); ?>" title="<?php bloginfo('name'); ?>"><img src="your-other-header-img.jpg" /></a>
    <?php } ?>
    </a>
    </div>

    hope that helps :)
    gerald

  4. kandik
    Member
    Posted 2 years ago #

    Yes it worked, thank you very much!
    Just not enough experience with php.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags