Simple WordPress theme exchanger.
composer require mimosafa\wp-theme-exchanger
Note: This library will not work after the setup_theme
action.
<?php
// In your plugin file
require_once( 'path/to/vendor/autoload.php' );
add_action( 'plugins_loaded', function() {
/**
* Theme slug
*
* @var string $extra_theme
*/
$extra_theme = 'awesome-theme';
$exchanger = new WP_Theme_Exchanger\Exchanger( $extra_theme );
if ( $_SERVER['REQUEST_URI'] === '/awesome' ) {
$exchanger->on();
}
} );