Last active
August 18, 2016 17:34
-
-
Save troutacular/ae0ebe2c9f92b9daf9631e84db3a950f to your computer and use it in GitHub Desktop.
JetPack: Remove sharing from excerpts or content
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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