WordPress.org

Support

Support » Themes and Templates » Pilcrow » [Resolved] Remove header image from subpages

[Resolved] Remove header image from subpages

  • I would like to have the header image only display on the home page. I do not see how to do this in the header.php file. Thank you.

Viewing 2 replies - 1 through 2 (of 2 total)
  • In the header.php look for the following code

    elseif ( get_header_image() ) : ?>
      <img src="<?php header_image(); ?>" width="<?php echo HEADER_IMAGE_WIDTH; ?>" height="<?php echo HEADER_IMAGE_HEIGHT; ?>" alt="" />
    <?php endif; ?>

    And change to the following:

    elseif ( get_header_image() ) : ?>
        <?php if ( is_home() || is_front_page() ) : ?>
          <img src="<?php header_image(); ?>" width="<?php echo HEADER_IMAGE_WIDTH; ?>" height="<?php echo HEADER_IMAGE_HEIGHT; ?>" alt="" />
        <?php endif; ?>
    <?php endif; ?>

    Remember always create a child theme first before making the aforementioned changes

    Thank you for your reply! As I was waiting for a response, I did find that very solution! Under <div id="pic"> I inserted <?php if( is_home () || is_front_page() ) :?> then inserted <?php endif;?> directly before the </div><!-- #pic --> line, and the header image disappeared on all pages except the home page.

    And yes, I have created a child theme. Thank you again.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] Remove header image from subpages’ is closed to new replies.
Skip to toolbar