Archived topic
Changing location of header element inside entry-content
5 replies · Started by William on May 5, 2021
Hi there,
I am talking to my advertising network and they have adverts to appear inside the content on the 4th paragraphs down. On a page such as this, it appears quite a way down the page, because the header element, which has some content (excerpt) in the element, is not classed in the entry-content.
If I could have the header element inside the div element entry-content, this would help ads load a little higher up the page, improving revenue. I've checked the hook locations and I am not sure if this is possible or not, could you advise?
Many thanks,
Will
Hi there,
By default, there's no hook inside entry-content.
https://github.com/tomusborne/generatepress/blob/b60b853630da6d9015722da903e53c8064148b0a/content-single.php#L71
Any reason why the Header element must be inside the entry-content?
If you want to load ads higher up the page, you can just use generate_after_header, generate_before_main_content or generate_before_content to hook your ads in instead of moving the Header Element lower down the structure.
It's because the company for advertising counts 'X' amount of paragraphs before showing the first advert. It would be useful to include the page hero as a paragraph etc. since it contains some content - otherwise, adverts will appear low, reducing the impressions it gets.
As I understand things, that's not possible to stick the page hero inside the entry-content?
Hi there,
to confirm what Elvin said - its not possible to move the Header Element to inside the entry-content using an Action Hook.
The only way to insert something in their is to filter the_content() but i am not sure that is possible to do that with the Header Element, as it was never designed for that.
Ah okay, not a worry - thanks for confirming that anyway!
Glad we could be of help