How to make child theme header.php override parent?
-
I want to insert a header image directly in my child theme directory, that overrides the parent’s header image.
I have tried to copy the header.php to my child theme directory and added a link to my image, like this:
<div class="header section" style="background-image: url(<?php if (get_header_image() != '') : ?><?php header_image(); ?><?php else : ?><?php echo get_template_directory_uri() . '/images/sunset-691204_1280.jpg'; ?><?php endif; ?>);">
I have also put the image in the images directory.
But the header.php does not override the parent theme’s header.php file.
Should I put some code in the beginning of the header.php file as I did with the css file, to make it import the parent files settings? Do I need to do something more to make it work?
I use the Hemingway theme downloaded from here: //www.andersnoren.se/teman/hemingway-wordpress-theme/
- The topic ‘How to make child theme header.php override parent?’ is closed to new replies.