Tagged: social buttons
-
AuthorPosts
-
March 22, 2015 at 7:29 pm #416037
A while back Josue gave me two wonderful snipets of code to add to my functions.php allowing me to display the “share this” buttons on my pages, portfolio items, and Woocommerce product pages. I think it needs a tweak after the latest update as instead of showing up at the bottom of pages/portfolio items, it now shows at the top, which is awkward. Can someone take a look and let me know how I might modify this after the latest update to get these back at the bottom after the avia builder content? Many thanks in advance! :)
// add social toolbar to pages & builder pages add_action('avia_after_content', 'avia_add_social_toolbars', 10, 2); function avia_add_social_toolbars($id = "", $context = "") { if($context == "page" || $context == "single-portfolio" || $context == "product") avia_social_share_links(); } add_filter('avf_template_builder_content', 'avia_add_social_toolbar_template_builder', 10, 1); function avia_add_social_toolbar_template_builder($content = "") { $content .= avia_social_share_links(array(), false); $content .= '<div style="height:1px; margin-top:50px;" class="hr"></div>'; return $content; } // add social toolbar to product pages (this still works great!) add_action('woocommerce_after_single_product_summary', 'avia_add_social_toolbar', 10, 2); function avia_add_social_toolbar($id = "", $context = "") { avia_social_share_links(); }
- This topic was modified 9 years, 8 months ago by Josue.
March 22, 2015 at 10:00 pm #416071Hi Crys!
Use this codes instead:
add_action('ava_after_content', 'avia_add_social_toolbars', 10, 2); function avia_add_social_toolbars($id = "", $context = "") { if($context == "page" || $context == "single-portfolio" || $context == "product") avia_social_share_links(); } add_filter('avf_template_builder_content', 'avia_add_social_toolbar_template_builder', 10, 1); function avia_add_social_toolbar_template_builder($content = "") { $content .= '<div id="custom_share_box" class="avia-section main_color container_wrap"><div class="container">'; $content .= avia_social_share_links(array(), '', '', false); $content .= '</div>'; return $content; }
Best regards,
JosueMarch 22, 2015 at 10:00 pm #416072And add this to Quick CSS:
#custom_share_box .av-share-box { margin-bottom: 30px; }
March 23, 2015 at 4:00 am #416179Fantastic thanks Josue, it’s back to normal and looking good! :)
March 23, 2015 at 7:02 am #416221You are welcome, glad to help :)
Regards,
JosueApril 1, 2015 at 2:18 pm #421896HI,
I ran into the same issue here, and tried the code Josue provided. Theme version 3.1.3.
I added this to my child theme’s style.css and functions.php, but the buttonbar is still on top of the pages….Any help?
rob- This reply was modified 9 years, 7 months ago by RobWu.
April 1, 2015 at 10:14 pm #422197Hi Rob,
Can you post the link to your website please?
Regards,
JosueApril 2, 2015 at 9:16 am #422351Hi Josue,
I managed to get it working, but there’s another issue now. My sidebar menu’s are moved at the bottom of the page, below the share buttons.
If I remove the code above, all is restored to normal.So I removed the buttons and code all together for now…..
rob
April 2, 2015 at 9:35 am #422358Hi,
That’s strange, can you please create me a WordPress administrator account? post it here as a private reply.
Regards,
JosueApril 2, 2015 at 10:29 am #422378Hi Josue,
Testing these things locally atm, so no login available for now.
I did upgrade the website online tot 3.1.3, but turned the buttons off for now, so I can have a better look at what is happening here.I’ll report back to you if I find something out.
rob
April 2, 2015 at 11:04 am #422390Ok, looking forward to hearing from you.
Regards,
JosueJune 17, 2016 at 10:16 am #649695This is an old thread, but I used Josue’s code to insert the sharing buttons at the end of a page with template builder content and found out that a closing div tag is missing.
Just in case somebody else runs into this, the correct code would be:add_action('ava_after_content', 'avia_add_social_toolbars', 10, 2); function avia_add_social_toolbars($id = "", $context = "") { if($context == "page" || $context == "single-portfolio" || $context == "product") avia_social_share_links(); } add_filter('avf_template_builder_content', 'avia_add_social_toolbar_template_builder', 10, 1); function avia_add_social_toolbar_template_builder($content = "") { $content .= '<div id="custom_share_box" class="avia-section main_color container_wrap"><div class="container">'; $content .= avia_social_share_links(array(), '', '', false); $content .= '</div></div>'; return $content; }
Thanks for the great support & documentation! :)
June 19, 2016 at 10:56 am #650397You are welcome, glad to help :)
Regards,
Josue -
AuthorPosts
- The topic ‘"Share this" snipet placement after update to 3.1.1’ is closed to new replies.