Archived topic
How to place textbox above post h1 title
11 replies · Started by Trish on December 16, 2022
Hi,
I've tried adding a hook but am not sure how to get that hook to appear on the posts.
Here's an image showing you the hook I created: https://www.awesomescreenshot.com/image/35427316?key=c82f9ddfdbfe91c7e4d70f0adb0e43c7
Also want to be able to customize the date line (for lack of the proper title). Again, that is explained best in my image here: https://www.awesomescreenshot.com/image/35427263?key=e9d74327ca7da621626ffa3a0f3a7b24
Thank you in advance,
Trish
Hi there,
for reference you can see the visual hook guide here.
1. Add a new Hook.
2. Select the generate_before_entry_title hook.
3. In the text area just add the HTML you want to display - you don't require the PHP function or add action.
4. Set the Display Rules accordingly.
See if you can get that working and then we'll look at the date meta requirements.
Hmmmm, there is no suggestion offered here: https://docs.generatepress.com/collection/hooks/ for that hook :-(
So... tried this: https://www.awesomescreenshot.com/image/35436419?key=f43b7f748b463f20bc2d18a6b7d6ce42 but that is a disaster. LOL!
Even tried changing "_above_" to "_before_" in the function call but that made NO change.
It doesn't look like you've followed David's suggestions 2-4.
This is all you need to do:
https://www.screencast.com/t/kXXRnZcyKYV
https://www.screencast.com/t/xoBBIGgKNi
Thank YOU Leo, for the correction... and that part is now completed... WOW!
I searched online like CRAZY trying discover how to add hooks to GP premium. I had NO idea they were THIS easy to add.
So... now my questions to complete this will be:
1.) how to center the text,
2.) change the color used to display the text, and
3.) make the text appear smaller than 20px.
Are you using the block editor?
It would be much easier if you are.
Yes Leo, I am... but when I open the post in edit view, I cannot see that block.
In that case, remove the current Hook element and add a Block Element Hook instead:
https://docs.generatepress.com/article/block-element-hook/
Then simply add a GB's headline block:
https://docs.generateblocks.com/article/headline-overview/
Then you can use the options to do the three things requested:
https://docs.generateblocks.com/article/headline-overview/#alignment
https://docs.generateblocks.com/article/headline-overview/#typography
https://docs.generateblocks.com/article/headline-overview/#colors
Okay... now I REALLY feel stupid. Where do I find the Block Element Hook to use, instead of the Hook Element? :-(
This should help:
https://www.screencast.com/t/2gbk4rwIa
Thank YOU, Leo!
Now I've got it.
No problem :)
I'll mark this topic resolved and please open a new topic for the new question.