The following code is from a wordpress plugin called 'featured comments' . It is by a highly regarded developer, so I know the code is 100% OK.
public static function instance() {
if ( ! isset( self::$instance ) ) {
self::$instance = new Featured_Comments;
self::$instance->includes();
self::$instance->init();
self::$instance->load_textdomain();
do_action( 'featured_comments_loaded' );
}
return self::$instance;
}
The developer uses a static method public static function instance() {
then instantiates it self::$instance = new Featured_Comments;
why? I am new to oop and thought that static methods don't need to be instantiated? Please can someone explain.
The full wordpress plugin can be found in the wordpress repository and is called 'featured comments'. Thanks!