How to add Facebook Chat to all pages

To display Facebook Chat plugin on all pages, you need to add its shortcode to your website's theme. After you configured the widget, add the following line to the footer.php file of your theme (right before the  </body>):

<?php echo do_shortcode('[elfsight_facebook_chat id="1"]'); ?>

Note: Don't forget to set the correct widget identifier in the id attribute of the shortcode (id="1")

Learn more about the do_shortcode function at https://developer.wordpress.org/reference/functions/do_shortcode/

For Child Themes

If you use a child theme, you can add the shortcode to the functions.php file of your child theme:

function elfsight_add_facebook_chat_shortcode_to_footer() {      echo do_shortcode('[elfsight_facebook_chat id="1"]'); } add_action('wp_footer', 'elfsight_add_facebook_chat_shortcode_to_footer');

Note: Don't forget to set the correct widget identifier in the id attribute of the shortcode (id="1")
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us