Try selecting “Front Page, Archive Pages, and Search Results” in the Sharing options.
Then, add the following code to your theme’s functions.php file:
// Remove sharing buttons on archive and search pages
function jptweak_remove_share() {
if ( is_archive() || is_search() ) {
remove_filter( 'the_content', 'sharing_display',19 );
remove_filter( 'the_excerpt', 'sharing_display',19 );
if ( class_exists( 'Jetpack_Likes' ) ) {
remove_filter( 'the_content', array( Jetpack_Likes::init(), 'post_likes' ), 30, 1 );
}
}
}
add_action( 'loop_start', 'jptweak_remove_share' );
That should do the trick.
Thread Starter
Halman
(@hectorhe)
Hello Jeremy, it works 100%! Thanks so much!!
Thread Starter
Halman
(@hectorhe)
Hello again Jeremy and users:
I’ve just released that buttons appears in my shop cart (Jigoshop). I used but nothing happen:
// Remove sharing buttons on archive and search pages
function jptweak_remove_share() {
if ( is_archive() || is_search() || is_post_type_product() ) {
remove_filter( ‘the_content’, ‘sharing_display’,19 );
remove_filter( ‘the_excerpt’, ‘sharing_display’,19 );
if ( class_exists( ‘Jetpack_Likes’ ) ) {
remove_filter( ‘the_content’, array( Jetpack_Likes::init(), ‘post_likes’ ), 30, 1 );
}
}
}
add_action( ‘loop_start’, ‘jptweak_remove_share’ );
Thanks so much for your time!
I’m not really familiar with Jigoshop, so I would suggest that you contact them for help and ask them for a conditional tag you could use to target your shop cart.
Thread Starter
Halman
(@hectorhe)
Hello Jeremy Herve:
The weird thing is the buttons appear in a top of page… Ok, I’m going to contact with Jingoshop to fix it.
Thanks so much!!
Piani
(@webbmasterpianise)
Thanks for the code Jeremy!
Old thread, but today this was exactly what I was looking for to remove the sharing on my search results. It worked perfect and easy 🙂