Archived topic
Add content between header and content/sidebar
9 replies · Started by Oliver on August 25, 2021
I would like to add content right after the header and just before the content and sidebar. In other words, I would like to push the content and sidebar down by adding content before them.
Hi there,
The inside_container and after_header hook should be what you are looking for:
https://docs.generatepress.com/article/hooks-visual-guide/#static-page
https://docs.generatepress.com/article/block-element-overview/
Thanks Leo, the after header hook worked perfectly!
EDIT: I´m having a hard time making a container the same width as the other content as you cn see here. I changed all width options while creating the hook element.
The padding is set to 40 px could it be that the margin value is not set to the same value as the other content?
Can you try the inside_container hook instead?
I did before trying after_header but it appeared left of the content container instead of over it
Hi there,
You can try generate_before_main_content hook. :D
Elvin i was able to generate the content after header no problem... I added a container and wish to make it so that the container has the same width as the rest of the content. When you visit the website you will see the container (with a blue background just for demonstration purpose) right after the secondary navigation. The container and the block itself are set to contained width but still the container is wider than the rest of the content.
Ah if that's the case:
The container you've inserted is actually of the same width w/ the contents already.
The main difference is the main content has padding and the container's background goes beyond the padding.
If you do a test by adding a background on the body's content as well, you'll notice that they're actually the same thing. Look at this one - https://share.getcloudapp.com/P8uGkN72 - You can see they are aligned. :D
But I believe I understand what you're trying to do.
You're aiming for something like this I believe? https://share.getcloudapp.com/bLuqgOlm
In this case, I placing the container block with blue background inside a container block the will serve as a wrapper. And then apply the width and padding on this "wrapper" container block. :)
You were perfectly correct as to what i was trying to achieve. Thanks a lot it worked! have a nice day.
No problem. Glad to be of any help. :)