Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Breakthrough in theme structure! #102

Closed
szepeviktor opened this issue Jun 2, 2020 · 6 comments · Fixed by #103
Closed

Breakthrough in theme structure! #102

szepeviktor opened this issue Jun 2, 2020 · 6 comments · Fixed by #103

Comments

@szepeviktor
Copy link
Contributor

szepeviktor commented Jun 2, 2020

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/

@szepeviktor
Copy link
Contributor Author

szepeviktor commented Jun 3, 2020

:) 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',
  ),
...

@davidhund
Copy link

👋🏻 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

?

@szepeviktor
Copy link
Contributor Author

szepeviktor commented Jun 5, 2020

Wordpress [PHP] files

plus the stylesheet, plus the screenshot ...

💻 🔫

@davidhund
Copy link

@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?

@szepeviktor
Copy link
Contributor Author

szepeviktor commented Jun 5, 2020

Nowhere!

WordPress core by itself will detect the template in a theme subfolder.
If you modify the active theme you need to reactivate it!

@davidhund
Copy link

If you modify the active theme you need to reactivate it!

🤪 Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants