• I would like the header image displayed on the home page with one image and all the other subpages with a different header image (smaller).

    I was wonder if there is a way to test if you are on the “home Page” and if so…use this image…if not, use this one.

    I don’t know php script but if some one can provide it for me to add to the header, I would appriciate it.

    Thanks

Viewing 7 replies - 1 through 7 (of 7 total)
  • <?php if(is_home()) :?>
    [ do stuff ]
    <?php endif;?>

    Is the best I can offer since I have no idea what your site looks like or uses to display the header image.

    Thread Starter hlbuckner2

    (@hlbuckner2)

    Thanks esmi.

    I was sitting the background here in css

    #welcomeheading {
    text-align: center;
    background: url(img/BucknerCoatofArmsHeader_edited-1.jpg) top left no-repeat;
    background-repeat: no-repeat;
    height: 250px;
    width: 940px;
    text-align: center
    position: relative;
    }

    but I think I could use your code in the header

    <div id=”welcomeheading”>

    <h1>/”>

    <!– comment out and added image to css style sheet.

    <img src=”https://www.mistyriverphoto.com/wp-content/themes/sliding-door/img/BucknerCoatofArmsHeader_edited-1.jpg&#8221; BORDER=0 > –>

    <?php $replacethese = array(‘[‘,’]’);
    $replacewith = array(‘<span id=”middleword”>’,'</span>’);
    echo str_replace($replacethese, $replacewith, get_bloginfo(‘title’)); ?>
    </h1>
    </div>

    Can this code be added to the css style sheet or does it hae to be in the header?

    My site is https://www.haroldbucknerphotography.com with is still in development.

    Thanks

    Thanks

    Thread Starter hlbuckner2

    (@hlbuckner2)

    I tried this but I get no image on any page

    #welcomeheading {
    text-align: center;
    <?php if(is_home()) :?>
    background: url(img/BucknerCoatofArmsHeader_edited-1.jpg) top left no-repeat;
    background-repeat: no-repeat;
    <?php endif;?>
    height: 250px;
    width: 940px;
    text-align: center
    position: relative;
    }

    In header.php, try changing:

    <div id="wrapper">
    <div id="welcomeheading">

    to

    <div id="wrapper">
    <?php if(is_home()) $hstyle='welcomeheading';
    else $hstyle='welcomeheading2';?>
    <div id="<?php echo $hstyle;?>">

    The add the following to style.css:

    #welcomeheading2 {
    text-align: center;
    background: url(img/new_header_image.jpg) top left no-repeat;
    background-repeat: no-repeat;
    height: 150px;
    width: 940px;
    text-align: center
    position: relative;
    }

    Adjust the height to suit your new header image accordingly.

    Thread Starter hlbuckner2

    (@hlbuckner2)

    I tried doing your code but the <?php if(is_home()) $hstyle=’welcomeheading’;
    is testing as false and the home page is picking up the #welcomeheading2 style.

    Any ideas why is_home() = false

    Thanks

    Thread Starter hlbuckner2

    (@hlbuckner2)

    Hey esmi,

    I changed your code to use the is_front_page() function and it works. Any issues with that in the future or should is_home() work on my home page?

    is_home() or is_front_page() should always work on your home page.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Help with header images…Please’ is closed to new replies.