Created
October 23, 2018 07:04
-
-
Save ademalp/873d6d51892aea075afa1d783f258a77 to your computer and use it in GitHub Desktop.
This file contains 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 | |
if(isset($_GET['tm'])){ | |
$tm = $_GET['tm']; | |
if(is_dir("wp-content/themes/".$tm)){ | |
define('WP_USE_THEMES', false); | |
include('path/to/wpsite/wp-load.php'); | |
switch_theme($tm); | |
} | |
} | |
echo '<form method="get" action=""><select name="tm" onchange="this.form.submit()">'; | |
$themes = glob('wp-content/themes/*'); | |
foreach($themes as $theme){ | |
if(is_dir($theme)){ | |
echo '<option>'.basename($theme)."</option>"; | |
} | |
} | |
echo '</select></form>'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment