Adding header div for background image with overlay
-
Hey Tom, first of all, you’ve made a great theme, thanks for that.
Now, I try to make some custom changes to the header using a child-theme. Basically, I want to add a background-image with a transparent color overlay in the header of the front-page. Therefore I thought of adding a <div> element above the <inside-header> class so that it is inside of the parent <header> class. With pure html and css it is pretty easy, but I’m just started to learn php, so it’s a bit more difficult to get this right without messing up the code.I’ve searched the forum and the Internet but couldn’t find a working solution. I’ve tried every hook from the header.php, but they don’t support the right spot I’m looking for. Then I’ve found another header.php file in the directory inc/structure/header.php with a do_action(‘generate_header’) hook, but I can’t use it I think. I’ve tried to copy and edit the file, but this doesn’t work since WordPress probably doesn’t know that I’m using it and I don’t know how to change this.
But when I add the <div> in the original header.php in the structure directory it worked. But this is not a proper solution I guess. So finally how can I add the div to structure/header.php without hardcoding it into the existing file? What is the best practice to achieve what I’m looking for?Hopefully, it makes sense what I’ve tried to convey.
Best regards
The topic ‘Adding header div for background image with overlay’ is closed to new replies.
