-
AuthorPosts
-
June 3, 2015 at 9:15 am #291001
Hi,
Please could you tell me how to add social share buttons (facebook, twitter) to every product?
thanks
5starmotoJune 3, 2015 at 3:20 pm #291548Hi There,
Thanks for writing.
You could try adding this code in your customizer’s Custom JavaScript:
jQuery( document ).ready(function() { jQuery( “.x-entry-share” ).insertBefore( “.single-product .product_meta” ); });
.single-product .product_meta <- class to be inserted. You can change it wherever you want.
Hope it helps.
Thanks.
June 4, 2015 at 8:21 am #292468thank you for the reply.
I have tried this but its not working? i might not be inserting facebook and twitter correctly, please could you show me the correct way?
thanks
5starmotoJune 4, 2015 at 8:46 pm #293052Hi There,
Because this requires a template change, I’d advise that you setup a child theme. This allows you to make code changes that won’t be overwritten when an X update is released. After your child theme is setup, please review how we recommend making template changes in Customization Best Practices. Then add this to your child theme’s functions.php file
/*adding social sharing buttons to woocommerce product pages */ add_action("woocommerce_single_product_summary", "add_social_sharing_to_product_page", 60); function add_social_sharing_to_product_page() { echo do_shortcode("[share title='Share this Product' facebook='true' twitter='true' google_plus='true' pinterest='true' email='true' class='mtl']"); }
Hope it helps, Cheers!
November 4, 2015 at 10:23 am #652432Hi,
I tried adding this code to my funcitons.php file. It works but does not show the interior of the share button (no “f” for facebook, etc.)Do you know how I would add that, or a better snippet of code to use for this functionality?
Thanks!
November 4, 2015 at 10:49 am #652468This reply has been marked as private.November 4, 2015 at 12:01 pm #652578Hi Landon,
I have checked on your page but I am getting the error:
Parse error: syntax error, unexpected T_STRING in /.../.../www/www/wp-content/themes/x-child/functions.php on line 42
Kindly fix it first so that we can check on this further. Thank you.
November 4, 2015 at 2:57 pm #652771Sorry for the inconvenience, I had a bit of a booboo today. It’s fixed. Can you take another look at it?
November 4, 2015 at 5:21 pm #652963Hi there,
Thanks for updating the thread! Upon checking your site, we see that you still have X-Shortcodes activated. Please deactivate and delete X-Shortcodes. Then install Cornerstone even if you don’t intend to use our new page builder. Cornerstone retires and replaces X-Shortcodes. The shortcodes required for X to funciton properly are within Cornerstone, hence it is a required plugin. Having both installed (even while deactivated) will cause conflicts.
Hope this helps – thanks!
-
AuthorPosts