Add ‘Via @Twitter Handle’ to Async Social Sharing’s Tweet Button - Make Money Online


Wednesday, 10 April 2019

Add ‘Via @Twitter Handle’ to Async Social Sharing’s Tweet Button

Async Social Sharing is a great social sharing plugin. The sharing buttons it provides looks decent, works well and above all, they are asynchronous. Unlike most of the other sharing plugins, this one doesn’t negatively affect page speed of a blog.

Being async, it makes sure that the page is rendered fast. At the same time, its social sharing capabilities are not compromised either! Okay, I agree that ‘look’ wise, it scores less than those fancy sharing plugins. But, talking about performance, it beats them all!

One problem about this plugin that used to give me headache was the ‘Tweet’ button. No, I’m not saying that the tweet button ceased to work. It worked fine. But, it didn’t allow me to insert the ‘via @mytwitterhandle’ part at the end of the tweet.

You see, when some visitor clicked on the tweet button to share my blog post with his/her Twitter followers, the format of the tweet made was like this- “The title of the post- url of the post”.

Normally, visitors would like to add the source of the post i.e Twitter handle of the author at the end of the tweet. Many social sharing plugins provide the opportunity to enable this feature within their ‘settings’.

Unfortunately, in the case of Async Social Sharing, there is no such setting. At the same time, my visitors were complaining about the absence of the ‘via @ mytwitterhandle’ section. They wanted to share the author’s Twitter handle, but were not willing to type it in. Now, I can’t blame the visitors too. They have every right to be impatient!

Finally, I decided to tweak the code of the plugin and bring in the missing part. I’ll guide you step-by-step through the process.

Steps to enable ‘via @twitterhandle’ on the Tweet button

Step 1

Add ‘Via @Twitter Handle’ to Async Social Sharing’s Tweet Button

First of all, on your WordPress Dashboard, go to Plugins > Editor.

Step 2

Add ‘Via @Twitter Handle’ to Async Social Sharing’s Tweet Button

Once you enter the editor, select ‘Async Social Sharing’ from the drop-down list of plugins.

Step 3

Add ‘Via @Twitter Handle’ to Async Social Sharing’s Tweet Button

Click on the ‘outputview.php’ file on the right sidebar, as shown in the figure.

Step 4

Find the coding of the tweet button there. It looks like this-


<?php if ( isset( $options['twitter'] ) ) : ?>
<li class=”twitter-share”>
<a href=”<?php echo esc_url( ‘’ ); ?>” class=”twitter-share-button” data-url=”<?php the_permalink(); ?>”>Tweet</a>

Now, concentrate on this part of the code-

CODE- <a href=”<?php echo esc_url( ‘’ ); ?>” data-url=”<?php the_permalink(); ?>”>Tweet</a>

Now, modify the above code as I did here-

MODIFIED CODE- <a href=”<?php echo esc_url( ‘’ ); ?>” data-url=”<?php the_permalink(); echo ” via @arunblogtips”;  ?>”>Tweet</a>

As you can see, I just added a line of code to it, the ‘echo “ via @twitterhandle”;’ part. In my case, it is @arunblogtips. Type in your own Twitter handle, you guys!

Step 5

Save the file and clear cache.

If all things have been done right, the via @yourtwitterhandle part will automatically appear when each visitor clicks the tweet button and tweets your blog post.

Once you make this change, the tweet counter on the buttons will be set to zero. That means, even if a post has been tweeted 10 times before us editing the code, the tweet count would revert back to zero.

But don’t worry, it is like ‘beginning afresh’. Once visitors start tweeting again, the count will rise up again. Do share this tutorial of you find it helpful!

No comments:

Post a comment