We have core classes created for theme and we are moving those classes to client-mu-plugins. Is there any way we can load all of the classes without adding require_once function for every single files? I tried spl_autoload_register()
function in every single ways but It's not loading.
File structure in plugin now
plugin_folder
-inc
- frontend
-class-post.php
-class-design.php
-class-video.php
- modules
-class-query.php
-class-config.php
- queries
- plugin-name.php
All of the class files also have Namespace defined. I'm not getting an idea on how to include those in custom plugins so it would work like it was working in theme folder. Could we use autoloader in someway? Appreciate your comments and help.
Namespace are defined on class files are like:
Foo\Frontend
Foo\Modules
Foo\Queries
Tried: https://github.com/tommcfarlin/simple-autoloader-for-wordpress/
Thanks
spl_autoload_register()
. I've also added namespace of class files.spl_autoload_register()
but I'm not getting any Namespace not sure how to debug that as well.