Created
October 11, 2015 14:09
-
-
Save twentyfortysix/50b9685c31875a1666bf to your computer and use it in GitHub Desktop.
Theme test drive like plugin (wordpress)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Theme drive | |
Description: Display different theme to user if logged in as admin | |
Author: Kyle Barber | |
*/ | |
add_filter('template', 'change_theme'); | |
add_filter('option_template', 'change_theme'); | |
add_filter('option_stylesheet', 'change_theme'); | |
function change_theme($theme) { | |
if ( current_user_can('manage_options') ) { | |
$theme = 'czechit-yo'; | |
} | |
return $theme; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment