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

Keep theme code in a subdirectory #3

Open
szepeviktor opened this issue Jun 16, 2022 · 3 comments
Open

Keep theme code in a subdirectory #3

szepeviktor opened this issue Jun 16, 2022 · 3 comments

Comments

@szepeviktor
Copy link
Contributor

szepeviktor commented Jun 16, 2022

e.g. theme
like in https://github.com/timber/starter-theme/tree/2.x

Again: separation of config files, documents -------------- and -------------- application code.

🦸🏻‍♂️ This is a secret WordPress core feature, needs no configuration at all.

@szepeviktor szepeviktor changed the title Keep theme files in a subdirectory Keep theme code in a subdirectory Jun 16, 2022
@kasparsd
Copy link
Contributor

Can you please elaborate on this one? This already has the theme in a sub-directory.

The prototype is specifically attempting to design a system where some themes, plugins and other dependencies would be developed as part of the same repo. The reason for that is to avoid the composer version update dance whenever a set of dependencies are updated.

Do you know any projects that do this?

@szepeviktor
Copy link
Contributor Author

szepeviktor commented Jun 16, 2022

Do you know any projects that do this?

Yes. Timber: https://github.com/timber/starter-theme/tree/2.x

Currently two kind of files are mixed.

  1. config files, for example package-lock.json
  2. and theme code, for example functions.php

Simply create a subdirectory inside the theme and move theme code into that directory: https://github.com/timber/starter-theme/tree/2.x/theme

So clean, @kasparsd. So clean!

@szepeviktor
Copy link
Contributor Author

szepeviktor commented Jun 16, 2022

🤫 WP core's code that finds this subdirectory automatically:
https://github.com/WordPress/WordPress/blob/89e99f57a2a175ccb75282d1a7eefb0bfce94bcb/wp-includes/theme.php#L515

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

No branches or pull requests

2 participants