init
This commit is contained in:
23
plugins/theme-directory.php
Normal file
23
plugins/theme-directory.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
/**
|
||||
* Plugin Name: Theme Directory
|
||||
* Description: Registers the repo-root themes/ directory as an additional theme root.
|
||||
*/
|
||||
|
||||
$repo_theme_root = dirname( ABSPATH ) . '/themes';
|
||||
|
||||
register_theme_directory( $repo_theme_root );
|
||||
|
||||
add_filter(
|
||||
'theme_root_uri',
|
||||
function ( $theme_root_uri, $siteurl ) use ( $repo_theme_root ) {
|
||||
// Core falls back to the raw filesystem path for registered roots it
|
||||
// cannot map to a URL; rewrite that to where nginx serves themes/.
|
||||
if ( $theme_root_uri === $repo_theme_root ) {
|
||||
return $siteurl . '/themes';
|
||||
}
|
||||
return $theme_root_uri;
|
||||
},
|
||||
10,
|
||||
2
|
||||
);
|
||||
Reference in New Issue
Block a user