WordPress plugin intelligence profile

Conditional Themes

A simple API to switch the themes on certain conditions.

WP PlugIndex snapshot

Current directory snapshot

Tested up to WordPress 5.2
Current version0.6
WordPress coverageTested up to WordPress 5.2
Minimum stackWP 3.4 · PHP —
Directory statusactive
Last directory update19 Jul 20197y ago
Active installations60Adoption metric — not a quality score
WordPress.org rating4.9 / 5 from 9 ratings
Official packageDirect from WordPress.org

Repository metrics are context, not quality scores. Active installations measure adoption and can strongly reflect a plugin’s age and historical popularity. Ratings, recent updates and “Tested up to” metadata also do not guarantee modern code, error-free operation, security, feature completeness or suitability for a particular site. Why active installs don’t tell the whole story →

WP PlugIndex currently records Conditional Themes version 0.6 as active, updated 7y ago and tested up to WordPress 5.2.

Overview

About this plugin

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.

WordPress.org metadata

Plugin tags

Topics listed for this plugin in the WordPress.org directory.

  • theme switcher
  • api
  • switch
  • themes
Compatibility & maintenance

Compatibility & maintenance

Tested up to WordPress 5.2

Not yet marked as tested with WordPress 7.1. WordPress.org currently lists Tested up to 5.2.

Current WordPress releaseWordPress 7.1
WordPress.org Tested up to5.2
Minimum requirementsWordPress 3.4 · PHP not listed
Update activity19 Jul 20197y ago

“Tested up to” is directory metadata supplied by the plugin author. WP PlugIndex does not turn an older declaration into a claim that the plugin is incompatible.

Changes recorded by WP PlugIndex

Recent tracked changes

No tracked version or compatibility changes have been recorded by WP PlugIndex yet.

Tracking & source

WP PlugIndex tracks public WordPress.org directory metadata and records selected version, compatibility and availability changes as they are detected.

Plugin watchlist

Watch this plugin

Sign in to your WP PlugIndex account or create a free account. Free accounts can watch up to 5 plugins and see what changed.

Watch limit

Watchlist limit reached

You have reached your current active watch limit.