• Resolved esark33

    (@esark33)


    Hi,

    For my site, how do I show the image (of the girl reading) only on the homepage? I was told to use conditional tags but after reading up on it I’m not sure I understand where or how to apply this.

    Thanks,
    Ed

Viewing 11 replies - 1 through 11 (of 11 total)
  • <?php if( is_home() ) :?>
    [ image markup ]
    <?php endif;?>

    Just the image? No copy? Create and use a static page and you can put whatever you want on it.

    Thread Starter esark33

    (@esark33)

    esmi, sorry to be such a noob – where do I place that, in index.php? header.php? I see the image referenced in my css file but that’s it.

    kmessinger, thanks – let me explore this route before tackling static pages.

    Ed

    From what I can see, the image is in a few template files. In index.php, you could try:

    <?php if( is_home() ) :?>
    <div class="slogan">
    <div class="slogan-indent"></div>
    </div>
    <?php endif;?>

    In single.php and any other template file that contains:

    <div class="slogan">
    <div class="slogan-indent"></div>
    </div>

    just try removing that markup.

    Thread Starter esark33

    (@esark33)

    I added that code to index.php.

    And removed (from sidebar-2.php) this:

    <div class="column-center">
    
    		<div class="slogan">
    			<div class="slogan-indent">
    				<h2><img alt="" src="<?php bloginfo('stylesheet_directory'); ?>/images/header-text.gif" /></h2>
    				<p><a href="#"><img alt="" src="<?php bloginfo('stylesheet_directory'); ?>/images/button-join.gif" /></a></p>
    			</div>
    		</div>

    (disregard the header-text.gif and button-join.gif images, they aren’t used)

    and got this. Getting closer but placement is messed up – does that have something to do with the <div class=”column-center”> in sidebar-2.php?

    Replace <div class="column-center"> in sidebar-2.php.

    Thread Starter esark33

    (@esark33)

    Sorry I highlighted too much in previous post – I only removed <div class="slogan"> and below. I did leave <div class="column-center"> there, it’s the last thing you see in sidebar-2.php.

    Have you edited the CSS at all. It seems to me that .column-center is missing a background color.

    Thread Starter esark33

    (@esark33)

    I haven’t edited any portion of the CSS that would affect that – why do you say that?

    esmi we’re almost there… I appreciate your help. Now that we’ve managed to get the image to show only on the homepage, how can I get it to show in the center column? I left the <div class="column-center"> in sidebar-2.php as you stated.

    Thanks,
    Ed

    why do you say that?

    I could have sworn that the center column had a light background similar to the 2 sidebars. Maybe I’m getting my sites confused? ??

    Try editing style.css and adding:

    margin: 0 auto;
    width: 489px;

    to:

    .slogan {
        background: url("images/header.jpg") no-repeat;
        clear: both;
        height: 214px;
    }
    Thread Starter esark33

    (@esark33)

    Did it!

    I just moved `<?php if( is_home() ) :?>
    <div class=”slogan”>
    <div class=”slogan-indent”></div>
    </div>
    <?php endif;?>` from index.php to sidebar-2.php.

    esmi THANK YOU for your help, couldn’t have done it without you.

    Cheers,
    Ed

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘how to show image only on homepage (blog page)’ is closed to new replies.