Archived topic
Static Text Above The Featured Image
9 replies · Started by Jahid on November 9, 2019
Hello
Is there any way to add particular text/sentences right before each featured image.
Want to display the text automatically on each post. Something like this one: https://ibb.co/2nzYbpj
Thanks
Hi there,
you can use the Hook Element:
https://docs.generatepress.com/article/hooks-element-overview/
The before_content hook is the one you want.
Thank you so much!
That's what I wanted.
One more question please. I used this following code in "before_content" hook.
<center><font size="2"><p>This site is reader-supported. When you buy through links on our site, we may earn an affiliate commission. <span style="color:#3a3a3a;"<a href="https://demosite/disclaimer/">Learn more...</a></span></p></font></center>
But now I see "learn more..." isn't hyperlinked. What am I missing? :/
Thanks
Maybe because you are missing > after <span style="color:#3a3a3a;?
You can always use this site to check the HTML for you:
https://validator.w3.org/
Just tried but it's still not fixed.
Where can I see the issue live?
It is likely an HTML issue. Have you made sure all the errors are solved from the HTMl checker?
I want to display that static text on Post only. You can check any Post on my site to see the live issue.
Unfortunately I am very new to coding. Couldn't solve the issue using HTML checker.
I would really appreciate if you look up at my page and share the exact code that I should add to the Hook Element.
Thanks
Looks like you've added the > inside the ", what if you added outside?
Thanks you so much, Leo!
It's perfect now.
BTW, is it possible to change the hyperlinked color here? I don't want to use the default hyperlink color here.
You can use HTML inline style similar to the example here:
https://www.w3schools.com/html/html_css.asp