-
Notifications
You must be signed in to change notification settings - Fork 0
Autoloading
The App
's autoloader takes in a class name like:
new My_Class_Name()
and converts it to e.g. my-class-name
and looks for a file named class-{my-class-name}.php
in app/
, components/
, and services/
folders. Note that the file name must be class-{my-class-name}.php
to be autoloaded.
It is suggested that you also place component or service classes in a folder named with the same conversion, e.g. services/{my-class-name}/class-{my-class-name}.php
for easy finding/navigation. But, as you will see, our recursive autoloader will still find it no matter what you name it.
Let's say you have your class-my-class-name.php
file in components/my-component/class-my-class-name.php
a new recursive autoloading feature in 2.0.0
will still find it as if it fails to find it in a app|components|service/my-class-name/
folder as it will recursively search for it.
wpkickstart is made with ♥ by Aubrey Portwood.