library switch_theme
Class for switch WordPress theme
megumi/switch_theme
Class for switch WordPress theme
- Friday, November 8, 2013
- by miya0001
- Repository
- 1 Watchers
- 0 Stars
- 176 Installations
- PHP
- 0 Dependents
- 0 Suggesters
- 0 Forks
- 0 Open issues
- 1 Versions
- 0 % Grown
Megumi_SwitchTheme() Class
Class for switch WordPress theme., (*1)
How to install in your project.
Add composer.json like below
{
"require": {
"megumi/switch_theme": "dev-master"
}
}
Download this package in your project.
composer install
Load this class.
require(dirname(__FILE__).'/vendor/autoload.php');
Example
Basic:, (*2)
<?php
/*
Plugin Name: Switch Theme
*/
require(dirname(__FILE__).'/vendor/autoload.php');
if (isset($_GET['test']) && $_GET['test']) {
$theme = new Megumi_SwitchTheme('my-mobile-theme');
$theme->apply();
}
Theme file is out of the wp-content/themes, (*3)
<?php
/*
Plugin Name: Switch Theme
*/
require(dirname(__FILE__).'/vendor/autoload.php');
if (isset($_GET['test']) && $_GET['test']) {
$theme = new Megumi_SwitchTheme(
'my-mobile-theme',
'/path/to/wp-content/mobile-themes',
'http://example.com/wp-content/mobile-themes'
);
$theme->apply();
}
License
GPL2, (*4)
dev-master
9999999-dev
Class for switch WordPress theme
Sources
Download
GPL2
The Requires
wordpress
theme