-
-
Save tommcfarlin/2b43bcb72aace6f51ca1b236bfc2fc0f to your computer and use it in GitHub Desktop.
[WordPress] Using a PHP Autoloader in WordPress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
spl_autoload_register( 'acme_namespace_demo_autoload' ); | |
/** | |
* @param string $class_name The fully-qualified name of the class to load. | |
*/ | |
function acme_namespace_demo_autoload( $class_name ) { | |
// If the specified $class_name does not include our namespace, duck out. | |
if ( false === strpos( $class_name, 'Acme_Namespace_Demo' ) ) { | |
return; | |
} | |
// Autoloading work goes here... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment