Below, you’ll find a detailed guide on how to add the Tawk.To Live Chat Shortcode to your WordPress website, including its parameters, examples, and PHP function code. Additionally, we’ll assist you with common issues that might cause the Tawk.To Live Chat Plugin shortcode not to show or not to work correctly.
Before starting, here is an overview of the Tawk.To Live Chat Plugin and the shortcodes it provides:
"Tawk.To Live Chat is a dynamic WordPress plugin that integrates live chat functionality into your website, enabling real-time interaction with your visitors and enhanced customer service."
- [tawkto]
Tawk.To Live Chat [tawkto] Shortcode
The Tawkto shortcode is a powerful tool in WordPress that allows you to embed live chat functionality on your website. This shortcode triggers the ‘shortcode_print_embed_code’ function when called. It adds an action to the ‘wp_footer’, which executes the ’embed_code’ function. This ensures that the live chat feature is embedded in the footer of your website, making it accessible on every page.
Shortcode: [tawkto]
Examples and Usage
Basic example – Utilizes the default Tawk.To chat widget as defined in your plugin settings. This shortcode will display the chat widget on the page where it is placed.
[tawkto /]
PHP Function Code
In case you have difficulties debugging what causing issues with [tawkto]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode( 'tawkto', array( $this, 'shortcode_print_embed_code' ) );
Shortcode PHP function:
function shortcode_print_embed_code() {
add_action( 'wp_footer', array( $this, 'embed_code' ), 100 );
}
Code file location:
tawkto-live-chat/tawkto-live-chat/tawkto.php
Conclusion
Now that you’ve learned how to embed the Tawk.To Live Chat Plugin shortcode, understood the parameters, and seen code examples, it’s easy to use and debug any issue that might cause it to ‘not work’. If you still have difficulties with it, don’t hesitate to leave a comment below.
Leave a Reply