Skip to content

Instantly share code, notes, and snippets.

@josephhinson
Created May 23, 2016 17:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save josephhinson/55fa523514de335f1566873be6aaf447 to your computer and use it in GitHub Desktop.
Save josephhinson/55fa523514de335f1566873be6aaf447 to your computer and use it in GitHub Desktop.
These are some useful function for extending the jetpack sharing features.
// Add Twitter @username to Jetpack Sharing
// from http://wpspeak.com/adding-twitter-handle/
function custom_add_twitterhandle_via() {
return 'username';
}
add_filter ( 'jetpack_sharing_twitter_via', 'custom_add_twitterhandle_via' );
// This function adds a colon after the title of the twitter share
function custom_sharing_title() {
$post = get_post();
if ( empty( $post ) ) {
return;
} else {
// Create sharing title
$sharing_title = get_the_title( $post->ID );
return $sharing_title .':';
}
}
add_filter( 'sharing_title', 'custom_sharing_title', 10, 3 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment