Twitter Hashtag, @ and Inline Tweet in WordPress

Advertisement

We can integrate Twitter Hashtag, @ and Inline Tweet in WordPress in several ways. It matters how you want to use the features in your blog. With time, Twitter API has undergone a huge change, possibly you will want to read about hashtag system, Twitter Hashtag and Twitter Tricks and Cheat Sheet With New API guide to get used with Twitter specific stuffs. Plugins are there, we will definitely mention but one must know the existence of non-WordPress Plugin ways to integration. Essentially, using lot of plugins can make your database quite pathetic. There are some “paid Plugins” too, although buying such is not recommended as they will try to use some API to authenticate your item which might compromise your security.

If we sanitize and add it on current Theme or Child Theme’s functions.php file, it will automatically link from text. But this is a hardcoded HTML link towards Twitter which you might not link. Possibly you know that, if @AbhishekCTRL is the username, we can reach it via hashtag too. These are same links :

Vim

1

2

3

https://twitter.com/#!/AbhishekCTRL

#equivalent to

https://twitter.com/AbhishekCTRL

Now, how we can create an inline Twitter Retweet Button, this is called Twitter Intent :

Vim

1

https://dev.twitter.com/docs/intents#retweet-intent

If you manually want to add a RT button, only inserting this after modification is enough :

The complex looking url is nothing but encoded url, you can read Percent-encoding and URL Encode/Decode to know more. You can retrieve an url in WordPress using the_permalink() function. That will make it automated. I will make it better in near future in fully handed way without using any plugin. I guess you have no complain now. Hashtag will get auto linked with that PHP script if you want. It is more easy – just a hyperlink, in case you want to manually do to prevent unwanted stuffs.

<aclass="twitter"href="http://twitter.com/home/?status=Twitter Hashtag, @ and Inline Tweet in WordPress https://thecustomizewindows.com/2014/08/integrate-twitter-hashtag-and-inline-tweet-in-wordpress/ by @AbhishekCTRL"target="_blank"title="Click to tweet this">Tweet this real working link<iclass="icon-twitter"></i></a>

As icon-font is already loaded on this webpage with CSS for other Twitter icon, we need not to load anything more. You can perform search on our website with related keywords for any required helpful in-depth guide.