/00-autoloader.php Secret
Last active
September 29, 2016 14:54
Star
You must be signed in to star a gist
[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