[Resolved] Want to replace my previous social share bars

Home Forums Support [Resolved] Want to replace my previous social share bars

Home Forums Support Want to replace my previous social share bars

Viewing 15 posts - 1 through 15 (of 26 total)
  • Author
    Posts
  • #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/efJ53Q

    Thanks in advance.

    #340371
    Leo
    Staff
    Customer Support

    Hi 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.

    #340427
    Eric

    Looks to be them, but I’m not sure what code to use to put the shortcode in there.

    #340444
    Tom
    Lead Developer
    Lead Developer

    Try 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.

    #340449
    Eric

    Thanks, Tom. I’ll try this out shortly.

    Looks like I was missing that “echo do_shortcode” part.

    #340461
    Eric

    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"]' );
    }
    #340512
    Tom
    Lead Developer
    Lead Developer

    Can you link me to the page it’s supposed to show up on?

    #340669
    Eric

    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?

    #340733
    Eric

    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!

    #340809
    Tom
    Lead Developer
    Lead Developer

    Glad you got it working 🙂

    #340850
    Eric

    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?

    #341099
    Tom
    Lead Developer
    Lead Developer

    Unfortunately 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.

    #341105
    Eric

    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.

    #363089
    Eric

    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.

    #363094
    Eric

    SOLVED: Using the plugin “simply show hooks”, I was able to see that the specific hook location in question changed to “generate_after_page_header”.

    Seems to work fine now.

    And as a side bonus, I can see what’s causing the problem I reported here and will be reporting it to Elementor:

Viewing 15 posts - 1 through 15 (of 26 total)
  • You must be logged in to reply to this topic.