Archived topic
Insert shortcode immediately below Post title
4 replies · Started by Penny on February 23, 2019
I'd like to insert a shortcode directly under the title on Single Posts.
I've read your https://docs.generatepress.com/article/using-hooks-conditional-tags/#single-posts and https://docs.generatepress.com/article/adding-php/ articles, and identified the generate-after-entry-title hook. Also, I installed the Code Snippets plugin.
But now I'm stuck. Can you outline what steps I need to take?
Hi there,
Have you considered using Hooks Element instead?
https://docs.generatepress.com/article/hooks-element-overview/
It should save you from writing the code.
Let me know :)
Hi Leo,
Thanks for pointing me to Hooks Elements.
I'm getting the DISALLOW_FILE_EDIT message and have read different takes on whether or not it's safe to allow file edits.
What is recommended?
If someone gained access to your Dashboard and were able to write PHP, they could potentially gain access to your server.
This is why DISALLOW_FILE_EDIT exists, to prevent a bad user from writing PHP in the Dashboard.
That being said, these days they could likely just install a plugin like Code Snippets and write it anyways.
If your Dashboard is secure (strong password, 2FA), then this is less of an issue, and you can probably allow file editing.
An even more powerful alternative to the Hooks element is Extender Pro: https://cobaltapps.com/downloads/extender-pro-plugin/
It's a premium extension (so paid), and not related to Tom or GP, but it is fully compatible with GP and also with other leading general frameworks/themes. It's a perfect companion to GP, and its author Eric is just as friendly and supportive as Tom :-)
Highy recommended!
I'm affiliated with neither GP nor Cobalt Apps, I'm just a happy user.