WordPress.org

Support

Support » How-To and Troubleshooting » Remove header image from other pages in Twenty Twelve

Remove header image from other pages in Twenty Twelve

  • Hi all,
    I would like to remove the header image from all pages but the front one.
    I’ve seen a few answers where people suggest to write some code…but where does this go? Looking at my Edit Page I can’t see where to write/remove the code….I’m a real newbie to this so big thanks in advance.

Viewing 8 replies - 1 through 8 (of 8 total)
  • esmi
    Forum Moderator

    @esmi

    Are you using a child theme?

    Do you mean have I got the “Apply options to children” box ticked? no.

    esmi
    Forum Moderator

    @esmi

    No. It means that you need to create and activate a child theme before you make these kinds of coding changes to the theme.

    Thanks for your comment. I am a complete novice at this so the child theme is like gobledigook to me.

    I researched how to do it using http://www.youtube.com/watch?v=j1UcL1ssazI and have done it. I got lost when she changed the title though after about 6.5 mins.

    Now, though, I can’t get the header image back on the front page…What do I do?
    Thanks agian

    esmi
    Forum Moderator

    @esmi

    You can download a pre-made Twenty Twelve child theme from here but, I should warn you, that some PHP, HTML & possibly CSS will be involved in the changes that you wish to make.

    Thank you for that and noted. Is it best then to have a child theme as standard and then write some code allowing for a header image on a particular page?

    esmi
    Forum Moderator

    @esmi

    Yes – absolutely! Once the child theme is in place, you should be able to handle this via a custom header.php file in the child theme’s folder. Changing:

    <?php $header_image = get_header_image();
    if ( ! empty( $header_image ) ) : ?>
    	<a href="<?php echo esc_url( home_url( '/' ) ); ?>"><img src="<?php echo esc_url( $header_image ); ?>" class="header-image" width="<?php echo get_custom_header()->width; ?>" height="<?php echo get_custom_header()->height; ?>" alt="" /></a>
    <?php endif; ?>

    to:

    <?php $header_image = get_header_image();
    if ( ! empty( $header_image ) && is_page(nn) ) : ?>
    	<a href="<?php echo esc_url( home_url( '/' ) ); ?>"><img src="<?php echo esc_url( $header_image ); ?>" class="header-image" width="<?php echo get_custom_header()->width; ?>" height="<?php echo get_custom_header()->height; ?>" alt="" /></a>
    <?php endif; ?>

    were nn = the id of your preferred Page should get you started.

    uknigerianchild
    Member

    @uknigerianchild

    I am aware that this thread is about a month old but pls I have the same the problem… I want to remove the header image from other pages on the 20/20 theme. Also, how do I remove the comments section on the front page? Pls help, somebody?

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Remove header image from other pages in Twenty Twelve’ is closed to new replies.