Skip to content

Instantly share code, notes, and snippets.

@jeremyfelt
Last active August 29, 2015 14:26
Show Gist options
  • Save jeremyfelt/9be8e21431a536d6f701 to your computer and use it in GitHub Desktop.
Save jeremyfelt/9be8e21431a536d6f701 to your computer and use it in GitHub Desktop.
Templates
<?php
class CLASS_NAME {
/**
* @var CLASS_NAME
*/
private static $instance;
/**
* Maintain and return the one instance and initiate hooks when
* called the first time.
*
* @return \CLASS_NAME
*/
public static function get_instance() {
if ( ! isset( self::$instance ) ) {
self::$instance = new CLASS_NAME;
self::$instance->load_plugins();
}
return self::$instance;
}
/**
* Load "plugins" included with the theme.
*/
public function load_plugins() {
// require_once( dirname( __FILE__ ) . '/includes/plugin-name.php' );
}
}
add_action( 'after_setup_theme', 'CLASS_NAME' );
/**
* Start things up.
*
* @return \CLASS_NAME
*/
function CLASS_NAME() {
return CLASS_NAME::get_instance();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment