Breakthrough in theme structure!
szepeviktor opened this issue · comments
Move all "WordPress files" under a subdirectory.
function _core_theme_subdir($directory) {
return $directory . '/template';
}
add_filter('template_directory', '_core_theme_subdir', 11, 1);
add_filter('stylesheet_directory', '_core_theme_subdir', 11, 1);
add_filter('template_directory_uri', '_core_theme_subdir', 11, 1);
add_filter('stylesheet_directory_uri', '_core_theme_subdir', 11, 1);
So config (and other) files can jump around in the root
and "WordPress files" in template/
:) It turns out we need No code :)
$ wp eval 'var_export(search_theme_directories(true));'
array (
'starter-theme/template' =>
array (
'theme_file' => 'starter-theme/template/style.css',
'theme_root' => '/home/user/website/code/public/wp-content',
),
...
👋🏻 I am just looking into using Timer and this Starter Theme.
Should I expect this MR to be merged and the 'Wordpress files' be moved into their own folder? 😏
Also: I agree the template
| templates
names are confusing.
Why not revert the Twig templates back to views
and use templates
for the 'Wordpress [PHP] files'?
./config
./templates/*.php
./views/*.twig
?
Wordpress [PHP] files
plus the stylesheet, plus the screenshot ...
💻 🔫
@szepeviktor I am a bit confused as to where the _core_theme_subdir
function should go?
Moving the stylesheet to a theme subfolder breaks the theme, so we need your _core_theme_subdir
functions, but where do I place this, since functions.php
etc. are also in that subfolder?
Nowhere!
WordPress core by itself will detect the template in a theme subfolder.
If you modify the active theme you need to reactivate it!
If you modify the active theme you need to reactivate it!
🤪 Thanks!