Skip to content

Instantly share code, notes, and snippets.

@JeffMatson
Created June 30, 2016 20:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JeffMatson/adf7eb1d57381d2cb7a923a2f533312a to your computer and use it in GitHub Desktop.
Save JeffMatson/adf7eb1d57381d2cb7a923a2f533312a to your computer and use it in GitHub Desktop.
<?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