- This topic has 25 replies, 3 voices, and was last updated 7 years, 2 months ago by
Tom.
-
AuthorPosts
-
June 27, 2017 at 3:13 pm #340361
Eric
Hi Tom,
I’ve switched over to Generatepress and my pagespeed/size has never been better!
As I purge out old and bloated plugins, I’ve been really wanting to replace my social share bars with Elementor share bars.
I need help replacing the share bars in these exact spots (see screenshot) on posts only. Those locations don’t seem to be in the GP Hooks module.
Screenshot:
https://ibb.co/efJ53QThanks in advance.
June 27, 2017 at 3:27 pm #340371Leo
StaffCustomer SupportHi there,
There are actually more hooks than the ones the module. See list here: https://docs.generatepress.com/collection/hooks/
I think what you are looking would be these two:
https://docs.generatepress.com/article/generate_after_entry_header/
https://docs.generatepress.com/article/generate_after_entry_content/Let me know if this helps.
June 27, 2017 at 7:43 pm #340427Eric
Looks to be them, but I’m not sure what code to use to put the shortcode in there.
June 27, 2017 at 8:26 pm #340444Tom
Lead DeveloperLead DeveloperTry this:
add_action( 'hook_name', 'tu_add_social_icons' ); function tu_add_social_icons() { echo do_shortcode( '[shortcode-here]' ); }
Replace hook_name with the name of the hook you want to use.
June 27, 2017 at 8:36 pm #340449Eric
Thanks, Tom. I’ll try this out shortly.
Looks like I was missing that “echo do_shortcode” part.
June 27, 2017 at 10:02 pm #340461Eric
Using this, I’m not seeing the shortcode working at all (regardless of which hook_name I’m using. Adding the shortcode directly to the GP Hooks module will get it working, but in the wrong spot:
add_action( 'generate_after_entry_header', 'tu_add_social_icons' ); function tu_add_social_icons() { echo do_shortcode( '[elementor-template id="20458"]' ); }
June 28, 2017 at 1:12 am #340512Tom
Lead DeveloperLead DeveloperCan you link me to the page it’s supposed to show up on?
June 28, 2017 at 6:53 am #340669Eric
I’m testing it on a private staging site right now. I’ve put that code in my child theme’s functions.php.
Should it go somewhere else?
June 28, 2017 at 8:35 am #340733Eric
Success!
I decided to add the code to the Code Snippets plugin and it worked – so I went back and caught something I overlooked in the file. All is well – thank you for the help!
June 28, 2017 at 9:43 am #340809Tom
Lead DeveloperLead DeveloperGlad you got it working 🙂
June 28, 2017 at 10:26 am #340850Eric
Ok, quick question:
I added a second share bar using the “generate_after_entry_content” location hook and it’s showing up below the related posts section. How do I get the share bar to be right above the related posts like in my screenshot in the OP?
June 28, 2017 at 8:06 pm #341099Tom
Lead DeveloperLead DeveloperUnfortunately this is due to how the related posts add their code. They typically filter into the end of the content, as the plugin doesn’t know if any hooks exist.
The only way to do it would be if the related posts plugin can disable automatic output, and you can add it yourself to the hook.
June 28, 2017 at 8:10 pm #341105Eric
No worries, Tom.
I’m using Jetpack and the related posts that it comes with. I’ll ask them if this is possible on their end (I believe they allow for modification of where it goes, but I’m not savvy enough to understand it all).
I’ll report back here when I get more info.
August 10, 2017 at 7:22 am #363089Eric
Hey guys, I’ve just updated to GP Premium 1.4.1 and it looks like my social share buttons moved from being under the featured image (where I want it) to under the post meta using the “generate_after_entry_header” hook.
Did the location change with this new version? I’d like to move those buttons back below the featured image.
Thanks.
August 10, 2017 at 7:29 am #363094 -
AuthorPosts
- You must be logged in to reply to this topic.