-
-
Save EranSch/f0d4c2b0e6073f128638 to your computer and use it in GitHub Desktop.
Singleton style plugin reference
This file contains hidden or 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
if ( ! defined( 'ABSPATH' ) ) exit; | |
add_action( 'plugins_loaded', array( 'Plugin_Class_Name', 'get_instance' ) ); | |
class Plugin_Class_Name { | |
private static $instance = null; | |
public static function get_instance() { | |
if ( ! isset( self::$instance ) ) | |
self::$instance = new self; | |
return self::$instance; | |
} | |
private function __construct() { | |
// Register hooks and shit here | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment