Messaging apps like WhatsApp are becoming a new way to share things with friends. Recently one of our users asked us how they can add a WhatsApp share button in their posts. In this article, we will show you how to add WhatsApp share button in WordPress.
First thing you need to do is install and activate the WhatsApp Share Button plugin. Upon activation, you need to visit Settings » WhatsApp Share Button to configure the plugin.
Automatically Show WhatsApp Share Button in WordPress
The plugin allows you to add WhatsApp share button both manually and automatically.
If you want to automatically display the button, then you need to check the options where you want it to be displayed.
Note: the plugin uses CSS code to detect a user’s screen size and will only show the WhatsApp button to users whose screen size is less than 1024px. If you are testing the plugin on your laptop, then you need to resize your browser screen until you see the button.
You can choose to show it on your posts, pages, and homepage. You can also choose the location of the button to be before or after the post content.
The last option on the settings page adds a utm parameter to the shared link. This is particularly useful for tracking links in Google Analytics.
Once you are satisfied with the options, click on the save button to store your settings.
Manually Add WhatsApp Share Button Using Shortcode
WhatsApp Share Button plugin comes with a shortcode, that you can add anywhere on your WordPress site to display the WhatsApp Share button.
Simply add [whatsapp] to your posts and pages where you want to display the button.
You can also use the shortcode inside a Text widget. By default, WordPress does not allow execution of shortcodes inside text widgets however you can enable this by adding a little code snippet into your theme’s functions.php file or a site-specific plugin.
Using The Shortcode To Share Any URL in WhatsApp
By default, the shortcode [whatsapp] automatically uses the URL of the currently displayed post or page. However, you can override this and add any URL that you want your users to share by using a shortcode like this:
[whatsapp title=”WPBeginner” url=”http://www.wpbeginner.com”]
That’s all. We hope this article helped you learn how to add a WhatsApp share button in WordPress. You may also want to see our list of 21 best social media monitoring tools for WordPress users.