- This topic has 3 replies, 2 voices, and was last updated 3 years, 3 months ago by Elvin.
-
AuthorPosts
-
December 10, 2020 at 11:29 am #1574764Michael
I need to add the Featured Image to the <header class=”entry-header> tag.
This <header> tag currently contains the entry title (as an H1) and then a custom field for a subtitle. I’d like to get the Featured Image to appear underneath the subtitle.
I can find a “generate_after_entry_header” hook, but this doesn’t work as it’s “after” and not “inside at end” 😉
Do I need to create template files or is there a way to achieve this within GeneratePress options/settings?
Many thanks
(Site is not online yet)
December 10, 2020 at 4:09 pm #1575042ElvinStaffCustomer SupportHi,
There’s no hook for “inside” the entry header unfortunately.
You can check these files and see that there’s none:
https://github.com/tomusborne/generatepress/blob/master/content.php
https://github.com/tomusborne/generatepress/blob/master/content-link.php
https://github.com/tomusborne/generatepress/blob/master/content-single.php
https://github.com/tomusborne/generatepress/blob/master/content-page.phphttps://docs.generatepress.com/article/hooks-visual-guide/
Do I need to create template files or is there a way to achieve this within GeneratePress options/settings?
Yes you’ll have to create a child theme and template to achieve this.
December 11, 2020 at 1:49 am #1575565MichaelThanks for those links – I found an answer which I think will do the job and won’t need a template:
generate_after_entry_title
.BTW, I had been looking at the Hooks Visual Guide reference. If I’m reading it correctly, I think on the ‘static page’ image it doesn’t show
generate_before_page_title
orgenerate_after_page_title
. But the https://github.com/tomusborne/generatepress/blob/master/content-page.php file shows that they are there – maybe a documentation bug?Thanks again – you’ve helped me get back on track!
December 11, 2020 at 2:15 am #1575598ElvinStaffCustomer SupportThanks for those links – I found an answer which I think will do the job and won’t need a template: generate_after_entry_title.
Oh lol, that’s right. I read entry_header but thought of something else. My bad.
But yes, that may work but that’s for posts. If you want to use something similar on static pages, use
generate_before_page_title
.But the https://github.com/tomusborne/generatepress/blob/master/content-page.php file shows that they are there – maybe a documentation bug?
Documentation images are a bit outdated. We’re actually in the process of of updating it for 3.0.2 as we’ve added more filters and hooks for flexbox but most of the things there are 95% the same.
Thanks again – you’ve helped me get back on track!
No problem. Glad to be of any help. 😀
-
AuthorPosts
- You must be logged in to reply to this topic.