Archived topic
before comments / after content hook
1 reply · Started by Moses on January 2, 2018
I probably don't fully understand this, but I think it should be pretty simple
1. I want to insert a shortcode to appear globally. I want it to be only after single blog posts (and before comments).
I noticed there's a before comment hook, but I don't understand how to restrict it to only blog posts, and I don't know what would happen if there are no comments or if comments are disabled.
2. as I understand hooks are specific places throughout the theme, where I can put content or code as I like.
What's are the best practices for doing such a thing?
- Using the sidebar item 'GP Hooks' and pasting the content to the desired hook?
- using a Code snippets plugin and somehow target the exact hook, and include the content? (because it seems that not all hooks are listed on 'GP Hooks')
- or maybe there's another way?
Hi there,
1. This should help: https://docs.generatepress.com/article/using-hooks-conditional-tags/#single-posts
It should still up above where the comments would be even if there are no comments or disabled.
Let me know if it doesn't.
2.
- If the hooks you are using is available in that module then yes
- Exactly, only the popular hooks are included in the Dashboard module.