I was wondering if anyone had to deal with an excessive amount of admin customizations through PHP and ended up creating e.g. a folder
admin sibling of
I’m thinking of a way to better create all the files and directories under this
Has anyone ever wondered or did something similar?
Maybe I haven’t got it, sorry about that.
Why are you “trying” to use the theme for admin customization instead of a plugin?
Due to the way
composer.json autoload is set maybe it’s better to have the
admin folder under the
app folder so everything under
admin would be autoloaded without the need to edit the
admin folder is under
app the file namespace would be:
Which means that file would be autoloaded with native setup.
admin folder should be named
Admin to comply with
psr-4 autoloading standard.
I ended up with this:
I’d appreciate if anyone shared ideas…
@Davide_Prevosto thanks for replying!
That’s a good question.
I actually already have a plugin in which I have many WP tweaks for the admin.
In this case I’m just wondering how I could do it without a plugin.
I mean, I’m thinking of a way to have a structure where any developer could easily understand and edit/delete those admin features for instance.
I also do this a lot:
setup/login.php (login screen customizations (logo, title, …))
setup/gutenberg.php (barrel file to include the other files)
setup/woocommerce.php (barrel file to include the other files)
Currently I am just requiring those files.
composer autoload feature looks cleaner.
@strarsis where is your
setup folder located? And do you have a reason for that? I’m just asking to have insights…
Thanks for sharing.
I’ve got your point @filipecsweb
app/setup/ directory of the Sage 8/9/10 theme.
The reason for naming the directory
setup/ is that there is already a
setup.php and the directory contains theme-setup-related files.