• [email protected]

    (@julianhaidnergmailcom)


    Hi. I really like your WordPress Theme. But i have to make the Header Image disapear on all pages except the homepage. How can i achieve that? Thanks for any help highly appreciated! Best regards Juian

Viewing 7 replies - 1 through 7 (of 7 total)
  • Walton

    (@walton)

    I don’t know which theme you mean. Landscape theme doesn’t appear to have a header image. However, this code should do it if you put it in the head:

    <?php if(is_home() ) {
    
    THE CODE THAT SHOWS THE IMAGE
    
    } else {
    
    WHATEVER YOU WANT IN PLACE OF THE HEADER IMAGE
    
    } ?>

    Thread Starter [email protected]

    (@julianhaidnergmailcom)

    Hi Walton. Thanks for your answer. I mean the Black Mountain picture in the landscape theme. This image is displayed on all pages throughout the site. Im looking to hide this image on all pages except the homepage. But i dont know what to do with your code? Would it help you out if i would post the code of the header.php file to point me in the right direction? thanks for your help in advance!

    Walton

    (@walton)

    This will make the picture disappear but leave the menu and site title

    Go header.php in Editor. Find the code that says:

    <div id="logo">
    			<h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
    			<h2 class="site-description"><?php bloginfo( 'description' ); ?></h2>
    		</div>

    And replace it with:

    `<?php if(is_home() ) {;?>

    <div id=”logo”>
    <h1 class=”site-title”>” title=”<?php echo esc_attr( get_bloginfo( ‘name’, ‘display’ ) ); ?>” rel=”home”><?php bloginfo( ‘name’ ); ?></h1>
    <h2 class=”site-description”><?php bloginfo( ‘description’ ); ?></h2>
    </div>
    <?php } else {;?>

    <h1 class=”site-title”>” title=”<?php echo esc_attr( get_bloginfo( ‘name’, ‘display’ ) ); ?>” rel=”home”><?php bloginfo( ‘name’ ); ?></h1>
    <h2 class=”site-description”><?php bloginfo( ‘description’ ); ?></h2>
    <?php } ?>

    There’s probably a more elegant way to do it but that should work.

    Walton, should there be the ` sign on first line above?

    should there be
    this code like 2 times?

    <h1 class="site-title">" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></h1>
    <h2 class="site-description"><?php bloginfo( 'description' ); ?></h2>
    </div>
    <?php } else {;?>
    
    <h1 class="site-title">" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></h1>
    <h2 class="site-description"><?php bloginfo( 'description' ); ?></h2>
    
    isnt 1 enough?
    
    <h1 class="site-title">" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></h1>
    <h2 class="site-description"><?php bloginfo( 'description' ); ?></h2>
    </div>
    <?php } else {;?>

    [Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum’s parser.]

    ok understand about

    php if

    else

    code
    but the ‘ sign on line 1?

    got it to work finally…

    @rmblfish

    I’m trying to do the exact same thing, mind posting your solution?

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘How to hide Header Image in other Pages than Homepage?’ is closed to new replies.