Last active
February 16, 2021 20:16
-
-
Save hirozed/3e25eeacd6fb68facaac95d8fe21634c to your computer and use it in GitHub Desktop.
WP Class Skeleton
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 | |
/* | |
* [Class Title] | |
*/ | |
class [className] { | |
/** | |
* Class Instance. | |
* | |
* @var object | |
*/ | |
private static $instance; | |
/** | |
* Singleton method. | |
*/ | |
public static function get_instance() { | |
if ( null === static::$instance ) { | |
static::$instance = new static(); | |
} | |
return static::$instance; | |
} | |
/** | |
* Construction Method. | |
* Set up variables and add hooks | |
*/ | |
protected function __construct() { | |
// Add WP hooks and calls to methods to be initialized | |
} | |
/** | |
* Clone Method. | |
*/ | |
private function __clone() { | |
} | |
/** | |
* Wakeup Method. | |
*/ | |
private function __wakeup() { | |
} | |
} | |
[className]::get_instance(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment