/** * Get the active instance of ThemeOption */ public static function getInstance() { if (!isset(self::$_instance)) { $class = __CLASS__; $helper = new $class(); self::$_instance = $helper->getOneBy(self::KEY_IS_ACTIVE, true); // If the default theme-option post is deleted from WordPress // then just create an instance on the fly which will use the default values in getFields if (!is_object(self::$_instance)) { self::$_instance = new $class(); } } return self::$_instance; }