/* Plugin Name: Conditional Themes Custom Plugin URI: https://www.brightwood.ie Description: Custom plugin to switch theme to BuddyBoss on Forum pages Author: Andrew Miller Author URI: https://www.brightwood.ie Version: 1.0 Text Domain: conditional-themes-custom Domain Path: /languages License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html */ add_action('plugins_loaded', 'my_conditional_themes_setup', 100); function my_conditional_themes_setup() { /// MAKE SURE DIVI IS LOADED ON THESE URLS: // if URL upgrade (keep this on top becasue it is priority match) if(strpos($_SERVER['REQUEST_URI'], 'upgrade') !== false) { Conditional_Themes_Manager::register('divi-child-theme', function() { return true; }); } else if(strpos($_SERVER['REQUEST_URI'], 'thank-you') !== false) { Conditional_Themes_Manager::register('divi-child-theme', function() { return true; }); } else if(strpos($_SERVER['REQUEST_URI'], 'register') !== false) { Conditional_Themes_Manager::register('divi-child-theme', function() { return true; }); } else if(strpos($_SERVER['REQUEST_URI'], 'login') !== false) { Conditional_Themes_Manager::register('divi-child-theme', function() { return true; }); } else if(strpos($_SERVER['REQUEST_URI'], 'product') !== false) { Conditional_Themes_Manager::register('divi-child-theme', function() { return true; }); } else if(strpos($_SERVER['REQUEST_URI'], 'membership-options') !== false) { Conditional_Themes_Manager::register('divi-child-theme', function() { return true; }); /// MAKE SURE BUDDYBOSS IS LOADED ON THESE URLS: // if URL is Forums // if(preg_match('\/the-chat-room(.*)', $_SERVER["REQUEST_URI"] ) !== false) { } else if(strpos($_SERVER['REQUEST_URI'], 'chat-room') !== false) { Conditional_Themes_Manager::register('buddyboss-theme-child', function() { return true; }); // if URL is members } else if(strpos($_SERVER['REQUEST_URI'], 'members') !== false) { Conditional_Themes_Manager::register('buddyboss-theme-child', function() { return true; }); // if URL is groups } else if(strpos($_SERVER['REQUEST_URI'], 'groups') !== false) { Conditional_Themes_Manager::register('buddyboss-theme-child', function() { return true; }); // if URL is activity } else if(strpos($_SERVER['REQUEST_URI'], 'activity') !== false) { Conditional_Themes_Manager::register('buddyboss-theme-child', function() { return true; }); } }