Archived topic
Adding subheading below post title
6 replies · Started by Matthew on December 21, 2022
On TheDesk.net, I use a Subheading plugin: https://wordpress.org/plugins/subheading
The Subheading plugin wants me to insert the following code wherever I want the subheading to display:
<?php if (function_exists('the_subheading')) { the_subheading('<p>', '</p>'); } ?>
On my old theme, I had the subheading appear below the title, but above the date and author line. On GeneratePress, I'm not seeing where in the theme editor I should add the PHP code to make it so the subheading appears below the title but above the date and author line.
Hi there,
You can create a Hook Element to enter that line of PHP snippet:
https://docs.generatepress.com/article/hooks-element-overview/
Then select the after_entry_title hook:
https://docs.generatepress.com/article/hooks-visual-guide/#single-post
Check the Execute PHP checkbox then set the hook priority to 5:
https://docs.generatepress.com/article/hooks-element-overview/#settings
Let me know if this helps :)
It seems like it should have worked, but it didn't...
This is what the site looks like now...
For reference, what's the sub-heading for this specific post in your screenshot?
Can you try adding a static text to the Hook to first check if it's adding?
For example, add this in your Hook Element:
<p>Sub-Heading</p>
Let us know if it appears.
The subheading should read:
"A last-minute funding deal fell through, leaving the company in an extremely difficult position."
I added the <p> code but that didn't do anything, either.
Update: Got it to work. While the installation instructions suggested that particular line of PHP, the plugin itself actually suggested adding this to the hook:
<?php the_subheading(); ?>
...d'oh.
Still, wouldn't have thought to add it as a hook element in the first place, so thank you for your help!
I see. Glad you resolved the issue! You're welcome, Matthew!
