Archived topic
Can't get hook elements to work
4 replies · Started by Neil on February 2, 2021
Hi
I've been trying to use hook elements, but have never managed to get them to show up on my pages. The latest one I tried was this: https://www.wplogout.com/create-social-sharing-buttons-in-generatepress-without-plugin/ - I can't get the social sharing icons to appear on the pages.
I previously attempted to get Yoast breadcrumbs to work, by following step-by-step instructions, also to no avail. Can you help me figure out what I'm doing wrong? See private info for login details.
Thank you very much!
Hi there,
I recommend watching the video on Hook Element found here:
https://docs.generatepress.com/article/hooks-element-overview/
The contents of that documents are useful info as well. Please check them out. :)
Here's a brief documentation of how to add yoast breadcrumbs:
https://docs.generatepress.com/article/adding-breadcrumbs/#using-hooks-element
As for the article you've linked:
While it's lengthy, most are pretty much correct except maybe for step #3.
3. Now go to the Hook Settings and Choose Hook Location as after_entry_content. Click on Execute PHP
generate_after_entry_content should be used instead of after_entry_content. This matters because having the wrong hook will not display the the Hook Element's code on the desired location.
Hi, I do things exactly as described in the video and documentation and still nothing shows on the page. I did use generate_after_entry_content. But nothing shows. I've cleared all caches several times. I"m at a loss as to why the hook element doesn't work.
Got it - I was using the hooks for posts rather than pages (which are quite different). They now show! Thanks for all your help :-)
Got it – I was using the hooks for posts rather than pages (which are quite different). They now show! Thanks for all your help 🙂
Ah that makes sense. Yes posts and page are completely different posts types. It's important to specify those as well.
Glad you got it sorted. No problem. :)