Archived topic
Want to replace my previous social share bars
25 replies · Started by Eric on June 27, 2017
Glad you found the solution! :)
I updated to GP Premium 1.5.6 and GP 2.0 and it seems that my previous fix won't work anymore.
I don't even see the hook "generate_after_page_header" anymore. Was this removed or replaced by something?
As it stands, I can only add a share bar before the featured image, but I want it after.
That hook still exists.
However, in GPP 1.5, the page header functionality was separated from the featured image functionality. Are you only using a static image?
Are you only using a static image?
The featured images I use are unique to each article (inserted using the native featured image option in WordPress) and the social share buttons were created using Elementor.
I've previously added a special code using Snippets to get those social share buttons to appear under the featured image and at the end of the article.
Any chance you can link me to one of the pages where the icons disappeared from?
Any of my articles, but here's an example
https://www.veganostomy.ca/ostomy-filter-stickers/
You can see the share buttons at the end of the article - those should also be right under the featured image. I made no changes to the snippet code I had from before updating to the newer version.
The code I have you earlier should work for that location:
add_action( 'generate_after_entry_header', 'tu_add_social_icons', 15 );
function tu_add_social_icons() {
echo do_shortcode( '[elementor-template id="20458"]' );
}
Unfortunately,"generate_after_entry_header" used to work until something changed in August, so I had to start using "generate_after_page_header" but now that's broken.
Have you tried again recently? That hook exists here: https://github.com/tomusborne/generatepress/blob/2.0/content-page.php#L40
Regardless of anything in GP Premium, that hook will work.
Oh, man. It was a caching issue :/ I had applied the code a few posts up and it didn't work at first, so I tested on my staging site and it was fine. I cleared the litespeed cache and now it's working =)
Thanks, Tom!!
No problem! :)