Archived topic
How to insert Jetpack sharing buttons?
5 replies · Started by Raymond on April 15, 2021
Hello guys, thanks for the pliable yet well coded theme.
I recently moved one of my sites to using this theme and everything has proceeded smoothly save for one thing I cannot find any previous response to. I use Jetpack's sharing button and had previously placed them below the entry meta (date and author), before the content (articles, that is). The theme I used then had a content-social.php and it was just a matter of replacing its contents (in a child theme) with the sharing_display function provided here.
How can I do the same with Generatepress?
Hi Raymond,
Can you try adding:
<?php sharing_display(); ?>
With a hook element in the desired spot and check to execute PHP?
https://docs.generatepress.com/article/hooks-element-overview/
https://docs.generatepress.com/article/hooks-visual-guide/
Also, are you using JetPack for anything else? If not I'd recommend finding a plugin specifically for the social sharing function.
Hi Leo,
Thank you for your response. I use Jetpack for related posts, sharing buttons, and automated social sharing; unused modules are disabled. It has the best related posts functionality I've tried out - which, apparently, is lighter on server resources compared to alternatives - and the automated sharing is a life saver.
I wasn't clearer earlier; what's stumping me is where in the theme to place hook. For example, generate_after_entry_content initially seems like a good option but it's a paragraph into an article, if I am not mistaken. How do I place a hook just after the date and author but before the entry content?
Just to make sure, you've created a hook element right?
If so the generate_after_entry_title hook should be what you are after as shown here:
https://docs.generatepress.com/article/hooks-visual-guide/#single-post
Thank you! I don't know how I missed the hooks visual guide. I implemented it with the generate_after_entry_header hook; -- after-entry-title placed it before the post metadata.
No problem :)