WhatsApp doesn’t officially offer a widget for WordPress. However, you can create a WhatsApp chat button/link using our WhatsApp Widget and then translate it into multiple languages to make it multilingual. Here’s a general guideline on how to achieve this:
Code for WordPress to add two widgets – one for each language:
<?php if ($current_language === 'es') {?>
<script defer src="https://widget.tochat.be/bundle.js?key=cd8de797-d27c-4296-9eba-76f4ce2efe23"></script>
<?php } elseif ($current_language === 'en') {?>
<script defer src="https://widget.tochat.be/bundle.js?key=c49aaa1a-b64c-40ec-854c-e70859f67cd5"></script>
<?php }?>
- Choose a WhatsApp Plugin:
- Go to your WordPress and add the code in your
- Search for a WhatsApp chat plugin. “Click to Chat” or “WP Social Chat” are some popular options. Install and activate the one you prefer.
- Set Up the Plugin:
- Once activated, you’ll typically find a settings page for the WhatsApp plugin. Go to the plugin settings.
- Configure the WhatsApp Button:
- In the plugin settings, you can customize the WhatsApp button’s appearance and behavior. You can specify the button’s position, color, text, and icon.
- Generate the WhatsApp Link:
- You’ll need to enter your WhatsApp phone number in the plugin settings. Make sure it includes the country code.
- The plugin will generate a WhatsApp link or button based on your settings.
- Add the WhatsApp Button to Your Website:
- Go to the page or location on your website where you want to display the WhatsApp button.
- Depending on your plugin, you can typically add it using a shortcode or a widget.
- Multilingual Support:
- To make the WhatsApp button multilingual, you’ll need a multilingual plugin like WPML or Polylang, or use translation plugins like Weglot or TranslatePress.
- Translate the WhatsApp button text and any other content you want to display in multiple languages.
- Display WhatsApp Button in Different Languages:
- Using your multilingual plugin, create different versions of the page or post in the languages you want to support.
- In each language version, insert the translated WhatsApp button or shortcode.
- Test the Multilingual Setup:
- Make sure to test the WhatsApp button in each language to ensure it works as expected.
Please note that the specific steps and plugins may have evolved since my last knowledge update in September 2021. Always refer to the documentation of the plugins you use for the most up-to-date instructions.
Remember to comply with WhatsApp’s terms of service and privacy policy when using WhatsApp on your website. Additionally, consider updating your plugins regularly to ensure compatibility and security.