Add/Remove/Edit The Social Product Sharing Links
With the Ocean Product Sharing extension you can add social sharing buttons with a beautiful style to your single product pages - WooCommerce and/or Easy Digital Downloads (EDD).
If you want to add, remove or edit social sharing links, follow these steps:
- Create a folder called
templates
inside your child theme folder -.../wp-content/themes/your-child-theme-folder-name/templates
- Create a folder called
extra
inside the previously addedtemplates
folder -.../wp-content/themes/your-child-theme-folder-name/templates/extra
- Copy and paste the
product-share.php
file into the previously created extra folder. This file is located inside the Ocean Product Sharing plugin (ocean-product-sharing/template
). The end path for your copied file will look like this:.../wp-content/themes/your-child-theme-folder-name/templates/extra/product-share.php
- Edit the copied
product-share.php
file (inside the child theme only!) to add classes, add or remove social sharing buttons and more.
If, for example, you added a new social sharing option, like WhatsApp, inside the product-share.php
file in the child theme, you also need to call this option correctly in order for it to work.
In that case, add the following code to the functions.php file of the child theme:
add_filter( 'ops_product_sharing_sites_filter', 'add_whatsapp_to_socials' ); function add_whatsapp_to_socials( $socials ) { if ( is_array( $socials ) && ! in_array( 'whatsapp', $socials, true ) ) { $socials[] = 'whatsapp'; } return $socials; }
Adjust the above code per need.
Note: If you already have the "templates" folder inside the child theme, you don't need to create another one.
New to WordPress? Learn all about WordPress child theme on our website.