This commit is contained in:
2026-07-19 22:09:52 +02:00
commit 63bb636255
9 changed files with 257 additions and 0 deletions

View 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
);