As seasoned WordPress developers, we've integrated social features like the official X (formerly Twitter) Follow Button across countless sites. This compact widget lets visitors follow any X account directly from your page, boosting engagement effortlessly. Unlike the older 'smart follow' button, which required full Twitter Anywhere setup and lacked customization, the official version displays follower counts and integrates seamlessly.
The X Follow Button is a lightweight widget that opens a preview window with user details upon click. See the demo in the image below (top-left corner):

It stands out from the smart follow button by supporting follower count display and simple setup—no complex integrations needed. Live example: Follow @wpbeginner
Visit the Follow Button generator or use this code (replace @wpbeginner with your handle):
<a class="twitter-follow-button" href="https://twitter.com/YOUR_USERNAME">Follow @YOUR_USERNAME</a> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
If you're already using the official Tweet Button, skip the script tag to avoid duplicates:
<a class="twitter-follow-button" href="https://twitter.com/YOUR_USERNAME">Follow @YOUR_USERNAME</a>
Paste into your theme's sidebar.php or use a Text widget: Go to Appearance » Widgets, drag a Text widget to your sidebar, and add the code. Here's an example:

No plugins required for this straightforward task—keep your site lean and fast.
For developers and designers, tailor the button to your brand with these attributes:
data-show-count: true or falsedata-size: large or small (formerly 'button')#ffffff)en, fr, de, es (ISO-639-1)300pxleft or rightExample with custom options:
<a class="twitter-follow-button" href="https://twitter.com/wpbeginner" data-show-count="true" data-size="large" data-text-color="#000000">Follow @wpbeginner</a> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
Resources:
Follow Button Documentation | Button Generator