Programming is easier using WP Autoload: a WordPress class autoloader

Have you ever thought about a WordPress autoload class? Are you tired with including classes manually in your WordPress coding?

Autoloading is a technique in PHP by which classes are automatically included. This is done according to their namespace. As a consequence, this removes the necessity of requiring PHP files manually. 

WP Autoload, a free WordPress scripts, gives an example. An example of one way to implement PHP autoloading for WordPress.

 

Installation of the WordPress autoload class

Include the WP Autoload Script as found on Github in any of your WordPress development projects.

Make sure that you adapt the Autoloading script according your namespacing and folder structure.

For example, a class with the namespace Components and a name Breadcrumbs may be called through new Components\Breadcrumbs(). Following the autoloader script, this file should be placed within components\breadcrumbs.php.

If configures succesfully, you now have set up a WordPress class autoloader. Your PHP classes will be automatically included if called.

Picture for WordPress Autoloader Class: no more manual loading
Yup, no more manually including files over and over again!

A Free WordPress Script Collection

During the years, we found out that we were repeating the same code over and over in our WordPress development projects. The obvious thought came in mind: Why don’t we store these pieces of code in reusable scripts on GitHub?

But we could just distribute them as free WordPress scripts! And so it happened, our repository was born. These are all free premium WordPress scripts. Have fun developing!

WP Autoload: a Free WordPress Class Autoloader 1