In the comments section of Full width responsive Featured image below header in Genesis with a fallback tutorial, a user asked:
I use the above code often, excellent thank you. Do you have a tutorial or a bit of code where I can add some text over just the home image – Im using Genesis Sample theme. I don’t mind it being hard coded in functions.php – although Widget better of course. ….( actually using an excerpt to deliver different text on different pages…but that’s something else!) Many Thanks
This article provides the steps to display an entry summary section showing the custom excerpt (if present) overlayed on top of the featured image on static Pages and single Posts in Genesis. If a Post or Page does not have a featured image, the section will not appear.
Screenshots:
When there is no custom excerpt:
When there is a custom excerpt:
Summary of steps:
- In a function hooked to
genesis_after_header
- if we are not on a static Page or Post page, abort.
- if there's no featured image, abort.
- display entry summary inside div.entry-summary > div.wrap while defining
entry-summary
context.
- In a function hooked to
genesis_attr_entry-summary
filter (this hook will work because we have defined the custom context)- if we are not on a static Page or Post page, abort.
- if featured image is present, add style attribute with background-image set to URL of the featured image
- if a custom excerpt is present, add
has-excerpt
class else addno-excerpt
class.
- Add support for the custom excerpt on static Pages
Step 1
Add the following in child theme's functions.php:
To view the full content, please sign up for the membership.
Already a member? Log in below or here.