{"id":7766,"date":"2026-02-28T13:16:54","date_gmt":"2026-02-28T13:16:54","guid":{"rendered":"https:\/\/blog.codoplex.com\/?p=7766"},"modified":"2026-04-19T10:05:01","modified_gmt":"2026-04-19T10:05:01","slug":"wordpress-plugin-theme-compatibility-check","status":"publish","type":"post","link":"https:\/\/blog.codoplex.com\/wordpress-plugin-theme-compatibility-check\/","title":{"rendered":"Ep.03: WordPress Plugin Theme Compatibility Check &#8211; Ensuring Versana is Active"},"content":{"rendered":"\n<p>Learn how to add WordPress plugin theme compatibility checking with simple if\/else code. Step-by-step guide to detect active themes, show admin notices, and prevent plugin errors for beginners.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Introduction<\/h2>\n\n\n\n<p>Welcome to Episode 3 of building the Versana Companion plugin! In <a href=\"https:\/\/blog.codoplex.com\/how-to-create-a-wordpress-plugin\/\" data-type=\"post\" data-id=\"7738\">Episode 2<\/a>, we created our basic plugin structure. Now we need to make it smart enough to check if the Versana theme is actually active.<\/p>\n\n\n\n<p>In this episode, you&#8217;ll learn <strong>WordPress plugin theme compatibility<\/strong> checking using simple if\/else statements. No complex code \u2013 just straightforward PHP that checks if the right theme is running before your plugin does anything.<\/p>\n\n\n\n<p><strong>Why does this matter?<\/strong> Imagine someone installs your plugin but uses a different theme. Your plugin tries to use Versana-specific features that don&#8217;t exist&#8230; BOOM! Errors everywhere. Let&#8217;s prevent that.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What We&#8217;ll Cover<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Why theme compatibility checking is essential<\/li>\n\n\n\n<li>How WordPress stores active theme information<\/li>\n\n\n\n<li>Writing a simple theme detection function<\/li>\n\n\n\n<li>Showing admin notices to users<\/li>\n\n\n\n<li>Stopping plugin features when wrong theme is active<\/li>\n\n\n\n<li>Testing all scenarios<\/li>\n\n\n\n<li>Handling child themes automatically<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Prerequisites<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Completed <a href=\"https:\/\/blog.codoplex.com\/how-to-create-a-wordpress-plugin\/\" data-type=\"post\" data-id=\"7738\">Episode 2 (basic plugin created)<\/a><\/li>\n\n\n\n<li>WordPress 6.0+ installed<\/li>\n\n\n\n<li>Versana Companion plugin activated<\/li>\n\n\n\n<li>Text editor open<\/li>\n\n\n\n<li>Basic understanding of if\/else statements<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Part 1: Why Check Theme Compatibility?<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">The Problem We&#8217;re Solving<\/h3>\n\n\n\n<p><strong>Scenario without theme check:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>User installs Versana Companion \u2713\nUser has Astra theme active (not Versana) \u2717\nPlugin tries to use versana_get_option() \u2717\nFunction doesn't exist \u2717\nFatal error appears \u2717\nSite breaks \u2717\nUser angry \u2717\nBad review \u2717<\/code><\/pre>\n\n\n\n<p><strong>Scenario with theme check:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>User installs Versana Companion \u2713\nPlugin checks theme \u2713\nWrong theme detected \u2713\nShows friendly notice: \"Need Versana theme\" \u2713\nProvides link to get theme \u2713\nSite works fine \u2713\nUser understands \u2713\nEveryone happy \u2713<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Real-World Example<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ \u274c WITHOUT THEME CHECK (Bad)\nfunction versana_companion_init() {\n    \/\/ Assumes Versana theme is active\n    $layout = versana_get_blog_layout(); \/\/ CRASH if Versana not active!\n    echo $layout;\n}\n\n\/\/ \u2705 WITH THEME CHECK (Good)\nfunction versana_companion_init() {\n    \/\/ Check theme first\n    if ( ! versana_companion_is_theme_active() ) {\n        return; \/\/ Stop safely\n    }\n    \n    \/\/ Safe to use Versana functions now\n    $layout = versana_get_blog_layout();\n    echo $layout;\n}<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Part 2: How WordPress Stores Theme Information<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Understanding Theme Storage<\/h3>\n\n\n\n<p>WordPress stores the active theme name in the database. We can check it with simple WordPress functions.<\/p>\n\n\n\n<p><strong>What WordPress tracks:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Active theme name: \"Versana\"\nTheme folder: \"versana\"\nParent theme (if child): \"Versana\" or empty\nTheme version: \"1.0.0\"<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">The Key WordPress Function<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ Get current theme information\n$theme = wp_get_theme();\n\n\/\/ What this returns:\necho $theme->get('Name');        \/\/ \"Versana\"\necho $theme->get('Version');     \/\/ \"1.0.0\"\necho $theme->get('Template');    \/\/ \"versana\" (folder name)<\/code><\/pre>\n\n\n\n<p><strong>Simple example:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$theme = wp_get_theme();\necho $theme->get('Name'); \n\n\/\/ If Versana active: Shows \"Versana\"\n\/\/ If Astra active: Shows \"Astra\"\n\/\/ If Twenty Twenty-Four active: Shows \"Twenty Twenty-Four\"<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Part 3: Creating the Theme Check Function<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Step 1: Open Your Plugin File<\/h3>\n\n\n\n<p>Open <code>versana-companion\/versana-companion.php<\/code> in your text editor.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 2: Add the Theme Check Function<\/h3>\n\n\n\n<p>Add this function <strong>after<\/strong> your constants and <strong>before<\/strong> the activation hook:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?php\n\/**\n * Plugin Name: Versana Companion\n * Description: Adds demo import and advanced features to Versana theme\n * Version: 1.0.0\n * Author: Your Name\n * Text Domain: versana-companion\n *\/\n\nif ( ! defined( 'ABSPATH' ) ) {\n    exit;\n}\n\n\/**\n * Plugin constants\n *\/\ndefine( 'VERSANA_COMPANION_VERSION', '1.0.0' );\ndefine( 'VERSANA_COMPANION_PATH', plugin_dir_path( __FILE__ ) );\ndefine( 'VERSANA_COMPANION_URL', plugin_dir_url( __FILE__ ) );\n\n\/**\n * Check if Versana theme is active\n * \n * This function checks if the active theme is Versana\n * or a child theme of Versana.\n * \n * @return bool True if Versana is active, false otherwise\n *\/\nfunction versana_companion_is_theme_active() {\n    \/\/ Get current theme information\n    $theme = wp_get_theme();\n    \n    \/\/ Get theme name\n    $theme_name = $theme-&gt;get('Name');\n    \n    \/\/ Check if theme name is \"Versana\"\n    if ( 'Versana' === $theme_name ) {\n        return true; \/\/ Versana theme is active!\n    }\n    \n    \/\/ Check if it's a child theme of Versana\n    $parent_theme = $theme-&gt;get('Template');\n    if ( 'versana' === $parent_theme ) {\n        return true; \/\/ Versana child theme is active!\n    }\n    \n    \/\/ Neither Versana nor child theme active\n    return false;\n}\n\n\/\/ Rest of your plugin code continues...\n<\/code><\/pre>\n\n\n\n<p><strong>Understanding this function line by line:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>function versana_companion_is_theme_active() {\n<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Creates a function we can call anywhere<\/li>\n\n\n\n<li>Returns true or false<\/li>\n\n\n\n<li>Descriptive name tells us what it does<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>    $theme = wp_get_theme();\n<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Gets information about current theme<\/li>\n\n\n\n<li>WordPress function, built-in<\/li>\n\n\n\n<li>Returns theme object with all details<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>    $theme_name = $theme-&gt;get('Name');\n<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Extracts theme name from object<\/li>\n\n\n\n<li>Returns: &#8220;Versana&#8221; or &#8220;Astra&#8221; or &#8220;Twenty Twenty-Four&#8221; etc.<\/li>\n\n\n\n<li>This is display name (what user sees)<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>    if ( 'Versana' === $theme_name ) {\n        return true;\n    }\n<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Checks if name is exactly &#8220;Versana&#8221;<\/li>\n\n\n\n<li>If yes, return true (theme is active)<\/li>\n\n\n\n<li>If no, keep checking<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>    $parent_theme = $theme-&gt;get('Template');\n    if ( 'versana' === $parent_theme ) {\n        return true;\n    }\n<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Gets parent theme folder name<\/li>\n\n\n\n<li>Important for child themes<\/li>\n\n\n\n<li>If parent is &#8220;versana&#8221;, return true<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>    return false;\n<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>If neither check passed<\/li>\n\n\n\n<li>Return false (Versana not active)<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Why Check Both Name and Template?<\/h3>\n\n\n\n<p><strong>Example scenarios:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ Scenario 1: Versana theme directly active\n$theme-&gt;get('Name');      \/\/ \"Versana\"\n$theme-&gt;get('Template');  \/\/ \"versana\"\nResult: TRUE \u2713\n\n\/\/ Scenario 2: Versana child theme active\n$theme-&gt;get('Name');      \/\/ \"My Custom Versana\"\n$theme-&gt;get('Template');  \/\/ \"versana\" (parent folder)\nResult: TRUE \u2713\n\n\/\/ Scenario 3: Different theme active\n$theme-&gt;get('Name');      \/\/ \"Astra\"\n$theme-&gt;get('Template');  \/\/ \"astra\"\nResult: FALSE \u2717\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Part 4: Using the Theme Check Function<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Step 3: Check Theme Before Doing Anything<\/h3>\n\n\n\n<p>Now let&#8217;s use our function. Update your plugin initialization:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/**\n * Initialize plugin only if Versana theme is active\n *\/\nfunction versana_companion_init() {\n    \/\/ FIRST: Check if correct theme is active\n    if ( ! versana_companion_is_theme_active() ) {\n        \/\/ Wrong theme! Don't load plugin features\n        return;\n    }\n    \n    \/\/ If we reach here, Versana theme is active\n    \/\/ Safe to load plugin features\n    \n    \/\/ For now, just show a success message\n    if ( is_admin() ) {\n        add_action( 'admin_notices', 'versana_companion_success_notice' );\n    }\n}\nadd_action( 'plugins_loaded', 'versana_companion_init' );\n\n\/**\n * Success notice - shows when theme is correct\n *\/\nfunction versana_companion_success_notice() {\n    ?&gt;\n    &lt;div class=\"notice notice-success is-dismissible\"&gt;\n        &lt;p&gt;\n            &lt;strong&gt;\u2713 Versana Companion is active and working!&lt;\/strong&gt;\n            Versana theme detected successfully.\n        &lt;\/p&gt;\n    &lt;\/div&gt;\n    &lt;?php\n}\n<\/code><\/pre>\n\n\n\n<p><strong>Understanding the logic:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>if ( ! versana_companion_is_theme_active() ) {\n    return;\n}\n<\/code><\/pre>\n\n\n\n<p>This means:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>If theme is NOT active (notice the <code>!<\/code>)<\/li>\n\n\n\n<li>Stop right here (<code>return<\/code>)<\/li>\n\n\n\n<li>Don&#8217;t execute any code below<\/li>\n\n\n\n<li>Plugin features don&#8217;t load<\/li>\n\n\n\n<li>No errors happen<\/li>\n<\/ul>\n\n\n\n<p><strong>Breaking down the condition:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ The exclamation mark (!) means \"NOT\"\n!  versana_companion_is_theme_active()\n\n\/\/ Read it as: \"If NOT theme active\"\n\/\/ Or: \"If theme is inactive\"\n\n\/\/ Same as writing:\nif ( versana_companion_is_theme_active() === false ) {\n    return;\n}\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Part 5: Adding User-Friendly Error Notice<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Step 4: Show Helpful Message for Wrong Theme<\/h3>\n\n\n\n<p>Users need to know WHY the plugin won&#8217;t work. Let&#8217;s add a helpful notice:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/**\n * Initialize plugin\n *\/\nfunction versana_companion_init() {\n    \/\/ Check theme compatibility\n    if ( ! versana_companion_is_theme_active() ) {\n        \/\/ Show error notice\n        add_action( 'admin_notices', 'versana_companion_theme_error_notice' );\n        return; \/\/ Stop plugin from loading\n    }\n    \n    \/\/ Theme is correct, continue...\n    if ( is_admin() ) {\n        add_action( 'admin_notices', 'versana_companion_success_notice' );\n    }\n}\nadd_action( 'plugins_loaded', 'versana_companion_init' );\n\n\/**\n * Theme error notice - shows when wrong theme active\n *\/\nfunction versana_companion_theme_error_notice() {\n    \/\/ Get current theme name to show user\n    $theme = wp_get_theme();\n    $current_theme = $theme-&gt;get('Name');\n    ?&gt;\n    &lt;div class=\"notice notice-error is-dismissible\"&gt;\n        &lt;p&gt;\n            &lt;strong&gt;\u26a0\ufe0f Versana Companion Error:&lt;\/strong&gt;\n            This plugin requires the Versana theme. \n            You currently have &lt;strong&gt;&lt;?php echo esc_html( $current_theme ); ?&gt;&lt;\/strong&gt; active.\n        &lt;\/p&gt;\n        &lt;p&gt;\n            &lt;a href=\"&lt;?php echo admin_url('themes.php'); ?&gt;\" class=\"button button-primary\"&gt;\n                Go to Themes\n            &lt;\/a&gt;\n            &lt;a href=\"https:\/\/wordpress.org\/themes\/versana\/\" class=\"button\" target=\"_blank\"&gt;\n                Get Versana Theme\n            &lt;\/a&gt;\n        &lt;\/p&gt;\n    &lt;\/div&gt;\n    &lt;?php\n}\n\n\/**\n * Success notice\n *\/\nfunction versana_companion_success_notice() {\n    ?&gt;\n    &lt;div class=\"notice notice-success is-dismissible\"&gt;\n        &lt;p&gt;\n            &lt;strong&gt;\u2713 Versana Companion is active!&lt;\/strong&gt;\n            Theme compatibility confirmed.\n        &lt;\/p&gt;\n    &lt;\/div&gt;\n    &lt;?php\n}\n<\/code><\/pre>\n\n\n\n<p><strong>Understanding the error notice:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$theme = wp_get_theme();\n$current_theme = $theme-&gt;get('Name');\n<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Gets current theme name<\/li>\n\n\n\n<li>Shows user what they have active<\/li>\n\n\n\n<li>Example: &#8220;Astra&#8221;, &#8220;Twenty Twenty-Four&#8221;, etc.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;div class=\"notice notice-error is-dismissible\"&gt;\n<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>notice<\/code> = WordPress admin notice styling<\/li>\n\n\n\n<li><code>notice-error<\/code> = Red background (error color)<\/li>\n\n\n\n<li><code>is-dismissible<\/code> = Shows X button to close<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?php echo esc_html( $current_theme ); ?&gt;\n<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>esc_html()<\/code> = Security function<\/li>\n\n\n\n<li>Prevents malicious code from running<\/li>\n\n\n\n<li>Always escape output!<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;a href=\"&lt;?php echo admin_url('themes.php'); ?&gt;\" class=\"button button-primary\"&gt;\n    Go to Themes\n&lt;\/a&gt;\n<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Creates button-styled link<\/li>\n\n\n\n<li>Links to WordPress themes page<\/li>\n\n\n\n<li>User can easily switch themes<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;a href=\"https:\/\/wordpress.org\/themes\/versana\/\" class=\"button\" target=\"_blank\"&gt;\n    Get Versana Theme\n&lt;\/a&gt;\n<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Links to Versana on WordPress.org<\/li>\n\n\n\n<li>Opens in new tab (<code>target=\"_blank\"<\/code>)<\/li>\n\n\n\n<li>User can download Versana theme<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Part 6: Complete Updated Plugin Code<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Your Full versana-companion.php File<\/h3>\n\n\n\n<p>Here&#8217;s everything together:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?php\n\/**\n * Plugin Name: Versana Companion\n * Description: Adds demo import and advanced features to Versana theme\n * Version: 1.0.0\n * Author: Your Name\n * Author URI: https:\/\/yourwebsite.com\n * License: GPL v2 or later\n * License URI: https:\/\/www.gnu.org\/licenses\/gpl-2.0.html\n * Text Domain: versana-companion\n * Domain Path: \/languages\n * Requires at least: 6.0\n * Requires PHP: 7.4\n *\/\n\n\/\/ Security check - prevent direct access\nif ( ! defined( 'ABSPATH' ) ) {\n    exit;\n}\n\n\/**\n * Plugin constants\n *\/\ndefine( 'VERSANA_COMPANION_VERSION', '1.0.0' );\ndefine( 'VERSANA_COMPANION_PATH', plugin_dir_path( __FILE__ ) );\ndefine( 'VERSANA_COMPANION_URL', plugin_dir_url( __FILE__ ) );\n\n\/**\n * Check if Versana theme is active\n * \n * Checks both direct theme activation and child theme scenarios\n * \n * @return bool True if Versana active, false otherwise\n *\/\nfunction versana_companion_is_theme_active() {\n    \/\/ Get current theme\n    $theme = wp_get_theme();\n    \n    \/\/ Check direct Versana activation\n    if ( 'Versana' === $theme-&gt;get('Name') ) {\n        return true;\n    }\n    \n    \/\/ Check if child theme of Versana\n    if ( 'versana' === $theme-&gt;get('Template') ) {\n        return true;\n    }\n    \n    \/\/ Versana not active\n    return false;\n}\n\n\/**\n * Initialize plugin\n * \n * Runs after all plugins are loaded\n *\/\nfunction versana_companion_init() {\n    \/\/ First: Check theme compatibility\n    if ( ! versana_companion_is_theme_active() ) {\n        \/\/ Wrong theme - show error and stop\n        add_action( 'admin_notices', 'versana_companion_theme_error_notice' );\n        return;\n    }\n    \n    \/\/ Theme is correct - continue initialization\n    if ( is_admin() ) {\n        add_action( 'admin_notices', 'versana_companion_success_notice' );\n    }\n    \n    \/\/ Future: Plugin features will be loaded here\n}\nadd_action( 'plugins_loaded', 'versana_companion_init' );\n\n\/**\n * Error notice for wrong theme\n *\/\nfunction versana_companion_theme_error_notice() {\n    \/\/ Get current theme name\n    $theme = wp_get_theme();\n    $current_theme = $theme-&gt;get('Name');\n    ?&gt;\n    &lt;div class=\"notice notice-error is-dismissible\"&gt;\n        &lt;p&gt;\n            &lt;strong&gt;\u26a0\ufe0f Versana Companion Error:&lt;\/strong&gt;\n            This plugin requires the Versana theme. \n            You currently have &lt;strong&gt;&lt;?php echo esc_html( $current_theme ); ?&gt;&lt;\/strong&gt; active.\n        &lt;\/p&gt;\n        &lt;p&gt;\n            &lt;a href=\"&lt;?php echo admin_url('themes.php'); ?&gt;\" class=\"button button-primary\"&gt;\n                Go to Themes\n            &lt;\/a&gt;\n            &lt;a href=\"https:\/\/wordpress.org\/themes\/versana\/\" class=\"button\" target=\"_blank\"&gt;\n                Get Versana Theme\n            &lt;\/a&gt;\n        &lt;\/p&gt;\n    &lt;\/div&gt;\n    &lt;?php\n}\n\n\/**\n * Success notice for correct theme\n *\/\nfunction versana_companion_success_notice() {\n    ?&gt;\n    &lt;div class=\"notice notice-success is-dismissible\"&gt;\n        &lt;p&gt;\n            &lt;strong&gt;\u2713 Versana Companion is active!&lt;\/strong&gt;\n            Theme compatibility confirmed.\n        &lt;\/p&gt;\n    &lt;\/div&gt;\n    &lt;?php\n}\n\n\/**\n * Plugin activation\n *\/\nfunction versana_companion_activate() {\n    add_option( 'versana_companion_version', VERSANA_COMPANION_VERSION );\n    add_option( 'versana_companion_activated', current_time( 'mysql' ) );\n}\nregister_activation_hook( __FILE__, 'versana_companion_activate' );\n\n\/**\n * Plugin deactivation\n *\/\nfunction versana_companion_deactivate() {\n    \/\/ Cleanup if needed\n}\nregister_deactivation_hook( __FILE__, 'versana_companion_deactivate' );\n\n\/**\n * Load text domain for translations\n *\/\nfunction versana_companion_load_textdomain() {\n    load_plugin_textdomain(\n        'versana-companion',\n        false,\n        dirname( plugin_basename( __FILE__ ) ) . '\/languages'\n    );\n}\nadd_action( 'plugins_loaded', 'versana_companion_load_textdomain' );\n<\/code><\/pre>\n\n\n\n<p><strong>File saved!<\/strong> Now let&#8217;s test it.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Part 7: Testing Theme Compatibility Check<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Test Scenario 1: Wrong Theme Active (Most Important!)<\/h3>\n\n\n\n<p><strong>Setup:<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Make sure Astra (or any theme except Versana) is active<\/li>\n\n\n\n<li>Versana Companion plugin is active<\/li>\n\n\n\n<li>Go to WordPress Dashboard<\/li>\n<\/ol>\n\n\n\n<p><strong>Expected Result:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\n\u26a0\ufe0f Versana Companion Error: This plugin requires \nthe Versana theme. You currently have Astra active.\n\n&#91;Go to Themes]  &#91;Get Versana Theme]           \u2715\n\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\n<\/code><\/pre>\n\n\n\n<p><strong>What you should see:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u2713 Red error notice at top of admin<\/li>\n\n\n\n<li>\u2713 Shows YOUR current theme name (not &#8220;Astra&#8221; if different)<\/li>\n\n\n\n<li>\u2713 Two buttons: &#8220;Go to Themes&#8221; and &#8220;Get Versana Theme&#8221;<\/li>\n\n\n\n<li>\u2713 X button to dismiss notice (but it comes back)<\/li>\n\n\n\n<li>\u2713 No other errors on page<\/li>\n\n\n\n<li>\u2713 Site still works fine<\/li>\n<\/ul>\n\n\n\n<p><strong>What the buttons do:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>&#8220;Go to Themes&#8221; \u2192 Takes you to Appearance \u2192 Themes<\/li>\n\n\n\n<li>&#8220;Get Versana Theme&#8221; \u2192 Opens WordPress.org in new tab<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Test Scenario 2: Correct Theme Active<\/h3>\n\n\n\n<p><strong>Setup:<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Activate Versana theme (Appearance \u2192 Themes \u2192 Versana \u2192 Activate)<\/li>\n\n\n\n<li>Keep Versana Companion plugin active<\/li>\n\n\n\n<li>Go to WordPress Dashboard<\/li>\n<\/ol>\n\n\n\n<p><strong>Expected Result:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\n\u2713 Versana Companion is active! Theme \ncompatibility confirmed.                     \u2715\n\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\n<\/code><\/pre>\n\n\n\n<p><strong>What you should see:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u2713 Green success notice<\/li>\n\n\n\n<li>\u2713 Checkmark icon<\/li>\n\n\n\n<li>\u2713 Positive confirmation message<\/li>\n\n\n\n<li>\u2713 X button to dismiss<\/li>\n\n\n\n<li>\u2713 No errors<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Test Scenario 3: Switch Themes While Plugin Active<\/h3>\n\n\n\n<p><strong>Setup:<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Start with Versana active (green notice showing)<\/li>\n\n\n\n<li>Go to Appearance \u2192 Themes<\/li>\n\n\n\n<li>Activate a different theme (Astra, Twenty Twenty-Four, etc.)<\/li>\n\n\n\n<li>Go back to Dashboard<\/li>\n<\/ol>\n\n\n\n<p><strong>Expected Result:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u2713 Red error notice appears immediately<\/li>\n\n\n\n<li>\u2713 Shows new theme name<\/li>\n\n\n\n<li>\u2713 Plugin stops working (safely)<\/li>\n\n\n\n<li>\u2713 No fatal errors<\/li>\n\n\n\n<li>\u2713 Site continues working<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Test Scenario 4: Child Theme of Versana<\/h3>\n\n\n\n<p><strong>First, create a simple child theme:<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Create folder: <code>wp-content\/themes\/versana-child\/<\/code><\/li>\n\n\n\n<li>Create file: <code>versana-child\/style.css<\/code><\/li>\n\n\n\n<li>Add this content:<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>\/*\nTheme Name: Versana Child\nTemplate: versana\nVersion: 1.0.0\n*\/\n<\/code><\/pre>\n\n\n\n<ol start=\"4\" class=\"wp-block-list\">\n<li>Activate Versana Child theme<\/li>\n\n\n\n<li>Check plugin notice<\/li>\n<\/ol>\n\n\n\n<p><strong>Expected Result:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u2713 Green success notice shows<\/li>\n\n\n\n<li>\u2713 Plugin recognizes child theme<\/li>\n\n\n\n<li>\u2713 No errors<\/li>\n\n\n\n<li>\u2713 Everything works<\/li>\n<\/ul>\n\n\n\n<p><strong>This proves our child theme detection works!<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Part 8: Understanding What We Built<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">How the Flow Works<\/h3>\n\n\n\n<p><strong>Visual Flow Diagram:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>User loads WordPress page\n         \u2193\nWordPress loads all plugins\n         \u2193\nOur plugin hook: plugins_loaded\n         \u2193\nversana_companion_init() runs\n         \u2193\nChecks: Is Versana active?\n         \u2193\n    \u250c\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2510\n    NO        YES\n    \u2193          \u2193\nShow error   Show success\nnotice       notice\n    \u2193          \u2193\nStop here    Continue\n(return)     loading features\n             \u2193\n         Plugin works!\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">The If\/Else Logic Explained<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>if ( ! versana_companion_is_theme_active() ) {\n    \/\/ Code here runs if theme is WRONG\n    add_action( 'admin_notices', 'versana_companion_theme_error_notice' );\n    return;\n}\n\n\/\/ Code here runs if theme is RIGHT\nadd_action( 'admin_notices', 'versana_companion_success_notice' );\n<\/code><\/pre>\n\n\n\n<p><strong>In plain English:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>IF theme is NOT active\n    THEN show error\n    AND stop here\nELSE (theme must be active)\n    Show success\n    Continue with plugin\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Why Return Early?<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>if ( ! versana_companion_is_theme_active() ) {\n    return; \/\/ STOPS HERE - very important!\n}\n\n\/\/ This code only runs if return didn't happen\n\/\/ Which means theme must be active\n<\/code><\/pre>\n\n\n\n<p>The <code>return<\/code> statement is like a STOP sign. Everything after it is skipped.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Part 9: Common Questions Answered<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Q1: Why check theme name AND template?<\/h3>\n\n\n\n<p><strong>Answer:<\/strong> To support child themes!<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ Parent theme active:\nName: \"Versana\"      \u2713 Caught by name check\nTemplate: \"versana\"  \u2713 Also matches\n\n\/\/ Child theme active:\nName: \"My Versana\"   \u2717 Doesn't match name\nTemplate: \"versana\"  \u2713 Matches template check!\n<\/code><\/pre>\n\n\n\n<p>Without template check, child themes wouldn&#8217;t work!<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Q2: What if user renames Versana theme folder?<\/h3>\n\n\n\n<p><strong>Answer:<\/strong> Our check still works!<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ Even if folder renamed to \"versana-modified\"\n$theme-&gt;get('Name');     \/\/ Still \"Versana\" (from style.css)\n$theme-&gt;get('Template'); \/\/ Still \"versana\" (parent reference)\n<\/code><\/pre>\n\n\n\n<p>The template check uses the parent theme&#8217;s folder name, which can&#8217;t change without breaking the child theme.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Q3: Do I need to check on EVERY page load?<\/h3>\n\n\n\n<p><strong>Answer:<\/strong> Yes, because theme can change anytime.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>User visits page \u2192 Theme check runs \u2192 All good\nUser switches theme \u2192 Next page load \u2192 Check runs \u2192 Wrong theme \u2192 Error shows\n<\/code><\/pre>\n\n\n\n<p>It&#8217;s a lightweight check (just reads one database value), so performance impact is minimal.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Q4: Why not just deactivate the plugin automatically?<\/h3>\n\n\n\n<p><strong>Answer:<\/strong> Too aggressive!<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\u274c Auto-deactivate:\n- Assumes user made mistake\n- User loses settings\n- Confusing behavior\n- Against WordPress guidelines\n\n\u2705 Show notice:\n- User stays in control\n- Clear explanation\n- Helpful actions\n- Professional approach\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Q5: What about multisite?<\/h3>\n\n\n\n<p><strong>Answer:<\/strong> Works automatically!<\/p>\n\n\n\n<p>Each site in a multisite network can have a different theme. Our check runs per-site, so it works correctly:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Site 1: Versana active \u2192 Plugin works\nSite 2: Astra active \u2192 Plugin shows error\nSite 3: Versana Child active \u2192 Plugin works\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Part 10: What&#8217;s Next<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">In This Episode, We Built:<\/h3>\n\n\n\n<p>\u2705 Theme detection function (simple if\/else) \u2705 Error notice for wrong theme (red box) \u2705 Success notice for right theme (green box) \u2705 Automatic child theme support \u2705 Safe plugin stopping (no crashes) \u2705 User-friendly error messages \u2705 Helpful action buttons<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Your Plugin Now:<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u2713 Detects active theme correctly<\/li>\n\n\n\n<li>\u2713 Shows appropriate notices<\/li>\n\n\n\n<li>\u2713 Stops safely if wrong theme<\/li>\n\n\n\n<li>\u2713 Works with parent and child themes<\/li>\n\n\n\n<li>\u2713 Provides helpful guidance to users<\/li>\n\n\n\n<li>\u2713 Never crashes the site<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Coming in Episode 4:<\/h3>\n\n\n\n<p><strong>Admin Settings Page<\/strong> &#8211; We&#8217;ll create:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Settings menu in WordPress admin<\/li>\n\n\n\n<li>HTML form with fields<\/li>\n\n\n\n<li>Save\/load settings<\/li>\n\n\n\n<li>Organize settings in tabs<\/li>\n\n\n\n<li>All with simple HTML and PHP (no complex frameworks)<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>Congratulations! You&#8217;ve successfully added <strong>WordPress plugin theme compatibility<\/strong> checking to Versana Companion. Your plugin is now smart enough to detect themes and guide users appropriately.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">What We Learned<\/h3>\n\n\n\n<p><strong>Technical Skills:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u2705 Using <code>wp_get_theme()<\/code> function<\/li>\n\n\n\n<li>\u2705 Checking theme name and template<\/li>\n\n\n\n<li>\u2705 Writing simple if\/else conditions<\/li>\n\n\n\n<li>\u2705 Creating admin notices (error and success)<\/li>\n\n\n\n<li>\u2705 Stopping code execution safely with <code>return<\/code><\/li>\n\n\n\n<li>\u2705 Escaping output with <code>esc_html()<\/code><\/li>\n<\/ul>\n\n\n\n<p><strong>Best Practices:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u2705 Always check dependencies before using them<\/li>\n\n\n\n<li>\u2705 Fail gracefully with helpful messages<\/li>\n\n\n\n<li>\u2705 Support child themes automatically<\/li>\n\n\n\n<li>\u2705 Provide actionable solutions<\/li>\n\n\n\n<li>\u2705 Test all scenarios thoroughly<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Key Takeaways<\/h3>\n\n\n\n<p><strong>For WordPress plugin theme compatibility:<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Check Early<\/strong> &#8211; Before loading any features<\/li>\n\n\n\n<li><strong>Check Always<\/strong> &#8211; On every page load<\/li>\n\n\n\n<li><strong>Support Children<\/strong> &#8211; Check both name and template<\/li>\n\n\n\n<li><strong>Show, Don&#8217;t Break<\/strong> &#8211; Display notices, don&#8217;t crash<\/li>\n\n\n\n<li><strong>Help Users<\/strong> &#8211; Provide clear next steps<\/li>\n\n\n\n<li><strong>Test Everything<\/strong> &#8211; All theme scenarios<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">Testing Checklist<\/h3>\n\n\n\n<p>Before Episode 4, verify:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>[ ] Error notice shows with wrong theme<\/li>\n\n\n\n<li>[ ] Success notice shows with Versana<\/li>\n\n\n\n<li>[ ] Buttons in error notice work<\/li>\n\n\n\n<li>[ ] Child themes are recognized<\/li>\n\n\n\n<li>[ ] No PHP errors in any scenario<\/li>\n\n\n\n<li>[ ] Notice is dismissible (X button works)<\/li>\n\n\n\n<li>[ ] Theme switching triggers appropriate notice<\/li>\n\n\n\n<li>[ ] No fatal errors occur<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Your Updated File Structure<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>versana-companion\/\n\u251c\u2500\u2500 versana-companion.php    \u2705 Updated with theme checking\n\u251c\u2500\u2500 readme.txt               \u2705 From Episode 2\n\u251c\u2500\u2500 includes\/                \u2705 Empty (for future)\n\u251c\u2500\u2500 admin\/                   \u2705 Empty (for Episode 4)\n\u2514\u2500\u2500 assets\/                  \u2705 Empty (for future)\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Troubleshooting Common Issues<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Issue 1: Notice Shows Even with Versana Active<\/h3>\n\n\n\n<p><strong>Check:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ Verify theme name spelling\n$theme = wp_get_theme();\necho $theme-&gt;get('Name'); \/\/ Should show exactly \"Versana\"\n\n\/\/ Check for extra spaces or different cases\nif ( 'Versana' === $theme-&gt;get('Name') ) { \/\/ Exact match\n<\/code><\/pre>\n\n\n\n<p><strong>Solution:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Theme name must be exactly &#8220;Versana&#8221; (capital V)<\/li>\n\n\n\n<li>Check your theme&#8217;s style.css header<\/li>\n\n\n\n<li>Ensure no extra spaces<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Issue 2: Notice Doesn&#8217;t Appear<\/h3>\n\n\n\n<p><strong>Check:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ Make sure hook is firing\nadd_action( 'plugins_loaded', 'versana_companion_init' );\n\n\/\/ Verify function exists\nif ( function_exists( 'versana_companion_init' ) ) {\n    echo \"Function exists!\";\n}\n<\/code><\/pre>\n\n\n\n<p><strong>Solution:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Syntax error preventing loading<\/li>\n\n\n\n<li>Check for missing semicolons<\/li>\n\n\n\n<li>Look in debug.log for PHP errors<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Issue 3: Both Notices Show at Same Time<\/h3>\n\n\n\n<p><strong>Problem:<\/strong> You see both red and green notices.<\/p>\n\n\n\n<p><strong>Cause:<\/strong> Logic error in if\/else<\/p>\n\n\n\n<p><strong>Solution:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ Make sure return statement exists\nif ( ! versana_companion_is_theme_active() ) {\n    add_action( 'admin_notices', 'versana_companion_theme_error_notice' );\n    return; \/\/ \u2190 This MUST be here!\n}\n\n\/\/ Success notice only reaches here if return didn't happen\nadd_action( 'admin_notices', 'versana_companion_success_notice' );\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Issue 4: Child Theme Not Recognized<\/h3>\n\n\n\n<p><strong>Check your child theme&#8217;s style.css:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/*\nTheme Name: Versana Child\nTemplate: versana    \u2190 Must be lowercase \"versana\"\n*\/\n<\/code><\/pre>\n\n\n\n<p><strong>Common mistake:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/*\nTemplate: Versana    \u2190 Wrong! Capital V won't work\n*\/\n<\/code><\/pre>\n\n\n\n<p><strong>Solution:<\/strong> Template must match parent folder name exactly (lowercase).<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Frequently Asked Questions<\/h2>\n\n\n\n<p><strong>Q: Does this check slow down my site?<\/strong> A: No. It runs once per page load and is just a database read. Negligible performance impact.<\/p>\n\n\n\n<p><strong>Q: Can I remove the success notice after testing?<\/strong> A: Yes! Once you verify it works, you can remove or comment out the success notice.<\/p>\n\n\n\n<p><strong>Q: What if someone has Versana but an old version?<\/strong> A: We&#8217;ll add version checking in a future episode. For now, any Versana version is accepted.<\/p>\n\n\n\n<p><strong>Q: Should I check theme on activation too?<\/strong> A: Optional. Current approach (checking on every load) is sufficient and catches theme changes.<\/p>\n\n\n\n<p><strong>Q: Can I customize the error message?<\/strong> A: Yes! Edit the text in <code>versana_companion_theme_error_notice()<\/code> function.<\/p>\n\n\n\n<p><strong>Q: What if WordPress adds a new theme function?<\/strong> A: Our method uses stable WordPress core functions that won&#8217;t change.<\/p>\n\n\n\n<p><strong>Q: Does this work with WordPress 5.x?<\/strong> A: Yes! The functions we use have been in WordPress for many versions.<\/p>\n\n\n\n<p><strong>Q: How do I test without switching themes constantly?<\/strong> A: You can temporarily modify the check to test different scenarios, then restore it.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Next Episode Preview<\/h2>\n\n\n\n<p><strong>Episode 4: Creating an Admin Settings Page<\/strong><\/p>\n\n\n\n<p>We&#8217;ll build:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Menu item in WordPress admin sidebar<\/li>\n\n\n\n<li>Settings page with HTML form<\/li>\n\n\n\n<li>Multiple input fields (text, checkbox, select)<\/li>\n\n\n\n<li>Save button that stores settings<\/li>\n\n\n\n<li>Load saved settings on page refresh<\/li>\n\n\n\n<li>Form validation and sanitization<\/li>\n<\/ul>\n\n\n\n<p>All using simple HTML and PHP \u2013 no frameworks needed!<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p><strong>Congratulations on completing Episode 3!<\/strong> Your plugin now has intelligent theme compatibility checking. See you in Episode 4 where we&#8217;ll add a settings page!<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p><strong>Series<\/strong>: <a href=\"https:\/\/blog.codoplex.com\/versana-companion-plugin\/\" data-type=\"category\" data-id=\"215\">Building Versana Companion Plugin<\/a><\/p>\n\n\n\n<p><strong>Episode<\/strong>: 3 of ongoing series (Theme Compatibility Check)<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Learn how to add WordPress plugin theme compatibility checking with simple if\/else code. Step-by-step guide to detect active themes, show admin notices, and prevent plugin errors for beginners.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[215],"tags":[270,216,111,44,209,7],"class_list":["post-7766","post","type-post","status-publish","format-standard","hentry","category-versana-companion-plugin","tag-versana","tag-versana-companion-plugin","tag-wordpress-block-theme","tag-wordpress-plugins","tag-wordpress-theme-companion-plugin","tag-wordpress-tutorials"],"_links":{"self":[{"href":"https:\/\/blog.codoplex.com\/wp-json\/wp\/v2\/posts\/7766","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.codoplex.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.codoplex.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.codoplex.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.codoplex.com\/wp-json\/wp\/v2\/comments?post=7766"}],"version-history":[{"count":1,"href":"https:\/\/blog.codoplex.com\/wp-json\/wp\/v2\/posts\/7766\/revisions"}],"predecessor-version":[{"id":7767,"href":"https:\/\/blog.codoplex.com\/wp-json\/wp\/v2\/posts\/7766\/revisions\/7767"}],"wp:attachment":[{"href":"https:\/\/blog.codoplex.com\/wp-json\/wp\/v2\/media?parent=7766"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.codoplex.com\/wp-json\/wp\/v2\/categories?post=7766"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.codoplex.com\/wp-json\/wp\/v2\/tags?post=7766"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}