Archived topic
generate-after-header hook appears after the closing header element.
3 replies · Started by Michael on July 2, 2020
This page https://docs.generatepress.com/article/generate_after_header/ says "The generate_after_header hook appears BEFORE the closing <header> element."
However when I use the hook it appears AFTER the closing <header> element.
I'm guessing the documentation is wrong and the hook is working as intended?
What I'm trying to achieve is to insert a full width (not contained) div at the bottom of the header area that includes the header background image. I then intend to give this new div it's own slightly transparent background colour so that I get a gentle transition between the header area and the rest of the site below.
I'm not sure if there's another hook that might do this (have looked - couldn't see anything), but any pointers appreciated. I'm building locally so can't provide a URL to show.
Thanks,
Mick
Hi there,
Oh wow that is a mistake for sure. I've just fixed that. Thanks for pointing it out!
Would you be able to use a header element for what you are trying to do?
https://docs.generatepress.com/article/header-element-overview/
Hi Leo,
Thanks for getting back and confirming that.
I managed to solve my problem by using hooks in the end. I wrapped the header with a div using before and after header hooks, then applied the header background image to that div instead. I could then insert an additional div just before the closing element of the new wrapper div and give it a height and a transparent background colour.
Works fine.
But, I will explore the header element option as well, about time I learned a bit about elements :)
No problem :)