Skip to content

Instantly share code, notes, and snippets.

@troutacular
Last active August 18, 2016 17:34
Show Gist options
  • Save troutacular/ae0ebe2c9f92b9daf9631e84db3a950f to your computer and use it in GitHub Desktop.
Save troutacular/ae0ebe2c9f92b9daf9631e84db3a950f to your computer and use it in GitHub Desktop.
JetPack: Remove sharing from excerpts or content
/**
* Remove the sharing functions for jetpack from the excerpt or content.
*/
function jetpack_modify_remove_excerpt_share() {
// Remove from exceprt.
remove_filter( 'the_excerpt', 'sharing_display',19 );
// Remove from page.
remove_filter( 'the_content', 'sharing_display',19 );
}
add_action( 'loop_start', 'jetpack_modify_remove_excerpt_share' );
/**
* Remove the sharing functions for jetpack based on page template.
*/
if ( get_page_template_slug( $post->id ) == "template-types/homepage.php" ) {
function jetpack_modify_remove_excerpt_share() {
// Remove from exceprt.
remove_filter( 'the_excerpt', 'sharing_display',19 );
// Remove from page.
remove_filter( 'the_content', 'sharing_display',19 );
}
add_action( 'loop_start', 'jetpack_modify_remove_excerpt_share' );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment