Created
June 30, 2016 20:07
-
-
Save JeffMatson/adf7eb1d57381d2cb7a923a2f533312a to your computer and use it in GitHub Desktop.
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 | |
if ( ! defined( 'ABSPATH' ) ) { exit; } | |
function nb_autoload( $classname ) { | |
$class = str_replace( '\\', DIRECTORY_SEPARATOR, str_replace( '_', '-', strtolower($classname) ) ); | |
$file_path = WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . $class . '.php'; | |
if ( file_exists( $file_path ) ) { | |
require_once $file_path; | |
} | |
} | |
spl_autoload_register('nb_autoload'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment