mimosafa/wp-theme-exchanger

Simple WordPress theme exchanger

1.0.0 2018-11-24 12:44 UTC

This package is auto-updated.

Last update: 2024-03-25 07:11:10 UTC


README

Build Status

Simple WordPress theme exchanger.

Installation

composer require mimosafa\wp-theme-exchanger

Example

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();
    }

} );