WPThumbs
Themes Plugins By purpose By industry Best-of lists Fix it guides
Free Plugin by Nashwan D v0.6

Conditional Themes

A simple API to switch the themes on certain conditions.

Conditional Themes

The facts

Rating
4.9★ from 9
Active installs
70+
Price
Free
Last updated
19 Jul 2019
Added
Oct 2013
Requires WP
3.4
Tested up to
WP 5.2.26
Downloads
5,013

Our analysis

AI-assisted

Conditional Themes is a WordPress plugin that allows you to switch themes based on specific conditions. It provides an API for developers to register conditions under which different themes will be activated, such as the user's browser or role. This plugin is suitable for developers looking to create dynamic theme experiences on their WordPress sites.

The plugin requires you to write additional code to define the conditions for theme switching. Examples include switching themes based on whether the visitor is using Internet Explorer or if the user has an administrator role. Developers can also enable persistent mode for theme switching based on time or content metrics.

Best for: Developers looking to implement conditional theme switching on WordPress sites.

What it does well

  • Free to use from the WordPress.org directory
  • Allows theme switching based on conditions
  • Suitable for developers with coding knowledge
  • Supports persistent mode for theme switching

Where it falls short

  • Requires coding knowledge to implement
  • Limited user base with only 70 active installs
  • Last updated in July 2019

Verdict

Conditional Themes offers a flexible solution for theme management based on user conditions, but it is primarily aimed at developers with coding skills.

From the developer

Nashwan D's own description of Conditional Themes, lightly tidied.

Conditional Themes is an API to switch the themes on certain conditions.

Usage

Write an another plugin file and use the Conditional Themes API as the example below:

add_action('plugins_loaded', 'my_conditional_themes_setup', 100);

function my_conditional_themes_setup()
{
    // Switch to Twenty Eleven theme if the visitor use Internet Explorer.
    Conditional_Themes_Manager::register('twentyeleven', function() {
        global $is_IE;
        return (bool) $is_IE;
    });

    // Switch to Twenty Thirteen theme if the user has administrator role.
    Conditional_Themes_Manager::register('twentythirteen', function() {
        return current_user_can('administrator');
    });

    // Switch to a custom theme if the visitor use a mobile device.
    Conditional_Themes_Manager::register('mobile', 'wp_is_mobile');
}

Another example, With enabling persistent mode.

add_action('plugins_loaded', 'my_conditional_themes_setup', 100);

function my_conditional_themes_setup()
{
    // Enable the switcher persistent mode.
    Conditional_Themes_Manager::set_option('persistent', true);

    // Switch to Twenty Sixteen theme when we being on 2016.
    Conditional_Themes_Manager::register('twentysixteen', function() {
        return (date('Y') == 2016);
    });

    // Switch to Twenty Fifteen theme when the site reaches 500 post.
    Conditional_Themes_Manager::register('twentyfifteen', function() {
        return ((int) wp_count_posts() > 500);
    });
}

Note: You can use Code Snippets plugin to add the code snippets to your site.

Contributing

Developers can contribute to the source code on the Github Repository.

Read the full description on the official page →

Tagged as

Alternatives

Other plugins for developer tooling.

WPCode

WPCode

93

Easily add code snippets in WordPress. Insert header & footer scripts, add PHP code snippets with conditio...

Free 3M+ installs 4.9★ (1,873)
Header Footer Code Manager

Easily add tracking code snippets, conversion pixels, or other scripts required by third party services for an...

Free 600k+ installs 4.9★ (309)
Admin and Site Enhancements

Duplicate post, post order, image resize, email via SMTP, admin menu editor, custom css / code, disable gutenb...

Free 200k+ installs 5★ (421)
Shortcoder

Create custom "Shortcodes" easily for HTML, JavaScript, CSS code snippets and use the shortcodes wit...

Free 100k+ installs 4.9★ (227)
Insert PHP Code Snippet

Add PHP code to your pages and posts easily using shortcodes.

Free 90k+ installs 4.9★ (705)
Code Snippets

An easy, clean, and simple way to enhance your site with code snippets.

Free 1M+ installs 4.7★ (509)