WordPress.org

Ready to get started?Download WordPress

Forums

Remove header image from other pages in Twenty Twelve (9 posts)

  1. sllim99
    Member
    Posted 1 year ago #

    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.

  2. esmi
    Forum Moderator
    Posted 1 year ago #

    Are you using a child theme?

  3. sllim99
    Member
    Posted 1 year ago #

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

  4. esmi
    Forum Moderator
    Posted 1 year ago #

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

  5. sllim99
    Member
    Posted 1 year ago #

    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

  6. esmi
    Forum Moderator
    Posted 1 year ago #

    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.

  7. sllim99
    Member
    Posted 1 year ago #

    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?

  8. esmi
    Forum Moderator
    Posted 1 year ago #

    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.

  9. uknigerianchild
    Member
    Posted 1 year ago #

    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?

Topic Closed

This topic has been closed to new replies.

About this Topic