Skip to content

Instantly share code, notes, and snippets.

@jeherve
Created November 16, 2015 20:26
Show Gist options
  • Select an option

  • Save jeherve/e9d872aaafa3e4f7fad0 to your computer and use it in GitHub Desktop.

Select an option

Save jeherve/e9d872aaafa3e4f7fad0 to your computer and use it in GitHub Desktop.
[Jetpack] Move Jetpack's sharing buttons from their default location to right under Woocommerce's product image.
<?php
/**
* Move Jetpack's sharing buttons from their default location to right under Woocommerce's product image
*
* @see http://jetpack.me/2013/06/10/moving-sharing-icons/
* @see http://businessbloomer.com/woocommerce-move-jetpack-social-sharing-single-product-page-tabs/ for an alternative placement
*/
function jeherve_move_jp_sharing_icons_woo() {
// Start by checking if Jetpack's sharing buttons are actually in use on the site
if ( function_exists( 'sharing_display' ) ) {
// Remove the buttons from their default location
remove_filter( 'the_content', 'sharing_display', 19 );
remove_filter( 'the_excerpt', 'sharing_display', 19 );
// Add them back.
echo sharing_display();
}
}
add_action( 'woocommerce_before_single_product_summary','jeherve_move_jp_sharing_icons_woo', 21 );
@thiagoprogramador
Copy link
Copy Markdown

This code, you insert into functions.php?

@jenniwerth
Copy link
Copy Markdown

I entered this code into my website (using code snippets plugin) and changed location to woocommerce_after_add_to_cart_button.
It added the sharing buttons to the correct location but did not remove them from their original location so that I now have duplicate buttons.
Can anyone help with code snippet to remove them? Thanks in advance :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment