How to Add Twitter Handle to Jetpack Sharing Module

Jetpack has many great features, including Sharing module to add popular social sharing buttons such as Facebook, Google Plus, Twitter, Pinterest and few more to every post on your site. Adding those buttons will make it easier for your readers to share your article to their social network, thus better exposure to your article.

retweet

In other social sharing plugins such as DiggDigg and Sharebar, you’ll be able insert your Twitter handle at the end of the article. However, in Jetpack, there’s no setting to add your Twitter handle.

1 2 3 4 5 6 7 8
<?php
//* Add Twitter handle to Jetpack Sharing module
add_filter ( 'jetpack_sharing_twitter_via', 'afn_add_twitterhandle_via' );
function afn_add_twitterhandle_via() {
return 'WPSpeak';
}
view raw jetpack-twitter-via.php hosted with ❤ by GitHub

Using the code above, you can add your Twitter handle after the tweet when someone click on the Twitter sharing button on your post. Please change the word WPSpeak with your own username.

Here’s what you’ll see. The filter will add via @yourusername to the end of the tweet.

Twitter handle

 

Comments

    • Editor says

      The title of the post tells everything you just asked :)

      Open up your theme functions.php file, and paste the code above into it. You don’t have to copy the <?php tag

Leave a Reply

Your email address will not be published. Required fields are marked *