April 20, 2024
You can use WP menu builder to build menus

Did you just write this awesome article on your WordPress website and you want to share it straightaway with your friends, via WhatsApp? Oh, wait, that is impossible because you don’t have a WhatsApp share button. Yet. This post is created to show you how easy is to add WhatsApp share button in WordPress.

1. Install and activate the WhatsApp Share Button plugin

2. Upon activation, go to Settings » WhatsApp Share Button to configure the plugin.

3. The plugin allows you to add WhatsApp share button both manually and automatically. In case you want to automatically display the button, you need to where you want it to be displayed. 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 re-size your browser screen until you see the button. You can show it on your posts, pages, and homepage, before or after the post content.

4. 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.

1 add_filter('widget_text', 'do_shortcode');

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, folks! Happy WhatsApp sharing!

Yael is a WordPress savvy; she loves to explore themes, plugins and even develops some of her own. She lives, breathes and eats code for breakfast. Yael tends to test every piece of WP code that she can put her hands on and then, write about it :-)

amit

No Comments

Leave a Comment