Andrew Nevins
(@anevins)
WCLDN 2018 Contributor | Volunteer support
First make a Child Theme.
I do have a child theme already
Andrew Nevins
(@anevins)
WCLDN 2018 Contributor | Volunteer support
Copy header.php from your theme and paste it into your Child Theme.
Andrew Nevins
(@anevins)
WCLDN 2018 Contributor | Volunteer support
In your Child Theme header.php file, wrap that conditional tag around the title and navigation:
<hgroup>
<h1 class="site-title"><a href="<?php echo home_url( '/' ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
</hgroup>
<nav role="navigation" class="site-navigation main-navigation">
<h1 class="assistive-text"><?php _e( 'Menu', 'spun' ); ?></h1>
<div class="assistive-text skip-link"><a href="#content" title="<?php esc_attr_e( 'Skip to content', 'spun' ); ?>"><?php _e( 'Skip to content', 'spun' ); ?></a></div>
<?php wp_nav_menu( array( 'theme_location' => 'primary' ) ); ?>
</nav><!-- .site-navigation .main-navigation -->
But use the exclamation mark in the conditional tag to say “if not”, rather than “if”.
<?php if( !is_front_page() ) { ?>
<hgroup>
<h1 class="site-title"><a href="<?php echo home_url( '/' ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
</hgroup>
<nav role="navigation" class="site-navigation main-navigation">
<h1 class="assistive-text"><?php _e( 'Menu', 'spun' ); ?></h1>
<div class="assistive-text skip-link"><a href="#content" title="<?php esc_attr_e( 'Skip to content', 'spun' ); ?>"><?php _e( 'Skip to content', 'spun' ); ?></a></div>
<?php wp_nav_menu( array( 'theme_location' => 'primary' ) ); ?>
</nav><!-- .site-navigation .main-navigation -->
<?php } ?>
yes great!
And now I can do the same for the footer?
and if I want to hide the background image on the front page, where is this located?
thanks very much for your direct online help!
btw is it now better to remove any other code from the header.php, so as not to interfere with any updates that the original theme makes?
If so, what should I delete and what not?
Andrew Nevins
(@anevins)
WCLDN 2018 Contributor | Volunteer support
And now I can do the same for the footer?
Yep.
and if I want to hide the background image on the front page, where is this located?
You’ll have to create a CSS style for this, in your Child Theme style.css file.
E.g:
body.home {
background: none;
}
btw is it now better to remove any other code from the header.php, so as not to interfere with any updates that the original theme makes?
Nope it is not better that way. Your Child Theme doesn’t just override particular code that you’ve changed in header.php, it overrides the whole header.php file.
I’m pretty terrible at css too, I must admit.
When I have created the style, then what?
thanks again…