Created
October 27, 2012 01:30
-
-
Save thefuxia/3962587 to your computer and use it in GitHub Desktop.
theme-roots.php
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: Local Theme Roots */ | |
| add_filter( 'theme_root_uri', 't5_switch_theme_root' ); | |
| add_filter( 'theme_root', 't5_switch_theme_root' ); | |
| /** | |
| * Create a custom theme directory. | |
| * | |
| * @wp-hook theme_root | |
| * @wp-hook theme_root_uri | |
| * @author Thomas Scholz, http://toscho.de | |
| * @param string $in URL or path | |
| * @return string | |
| */ | |
| function t5_switch_theme_root( $in ) | |
| { | |
| // local multi-sites end with 'mu.wp'. Example: t5.mu.wp. | |
| if ( 0 !== stripos( strrev( $_SERVER['HTTP_HOST'] ), 'pw.um' ) ) | |
| { | |
| return $in; | |
| } | |
| if ( 'theme_root_uri' === current_filter() ) | |
| { | |
| return "http://themes.wp/"; | |
| } | |
| $new_root = dirname( dirname( __DIR__ ) ) . '/wp-themes'; | |
| // If we made it so far we are in the 'theme_root' filter. | |
| register_theme_directory( $new_root ); | |
| return $new_root; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment