zebfross
Forum Replies Created
-
I was able to do this by creating a mu-plugin to disable the plugin completely for specific pages. It has the added benefit of not even taking time to run the plugin code when it is disabled. Create this file in
wp-content/mu-plugins/important-filters.php
with contents:<?php // make sure this isn't an admin page if (!preg_match('/wp-admin/', $_SERVER['REQUEST_URI'])) { if (!preg_match('/woocommerce/', $_SERVER['REQUEST_URI'])) { // remove the plugin from active plugin list add_filter('option_active_plugins', function($value, $option) { if (($key = array_search("facebook-messenger-customer-chat/facebook-messenger-customer-chat.php", $value)) !== false) { array_splice($value, $key, 1); } return $value; }, 10, 2); } }
This will remove the facebook plugin from non-admin pages that don’t match “woocommerce”. You can change the logic however you need to suit your needs.
Yes, you can do this! Just add an onclick handler to your button like this:
<div class="button" onclick="FB.CustomerChat.showDialog();">Click to Chat!</div>
I found some other useful commands here: https://developers.facebook.com/docs/messenger-platform/discovery/customer-chat-plugin/sdk#install
One way would be to only enable the plugin for some pages. Create this file in
wp-content/mu-plugins/important-filters.php
with contents:<?php // make sure this isn't an admin page if (!preg_match('/wp-admin/', $_SERVER['REQUEST_URI'])) { if (!preg_match('/my-chat-page/', $_SERVER['REQUEST_URI'])) { // remove the plugin from active plugin list add_filter('option_active_plugins', function($value, $option) { if (($key = array_search("facebook-messenger-customer-chat/facebook-messenger-customer-chat.php", $value)) !== false) { array_splice($value, $key, 1); } return $value; }, 10, 2); } }
This will remove the facebook plugin from non-admin pages that don’t match “my-chat-page”.
- This reply was modified 3 years, 9 months ago by zebfross. Reason: added comments