/**
  * Main Starter_Plugin_Settings Instance
  *
  * Ensures only one instance of Starter_Plugin_Settings is loaded or can be loaded.
  *
  * @since 1.0.0
  * @static
  * @return Main Starter_Plugin_Settings instance
  */
 public static function instance()
 {
     if (is_null(self::$_instance)) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
Ejemplo n.º 2
0
 /**
  * Constructor function.
  * @access  public
  * @since   1.0.0
  */
 public function __construct()
 {
     $this->token = 'starter-plugin';
     $this->plugin_url = plugin_dir_url(__FILE__);
     $this->plugin_path = plugin_dir_path(__FILE__);
     $this->version = '1.0.0';
     // Admin - Start
     require_once 'classes/class-starter-plugin-settings.php';
     $this->settings = Starter_Plugin_Settings::instance();
     if (is_admin()) {
         require_once 'classes/class-starter-plugin-admin.php';
         $this->admin = Starter_Plugin_Admin::instance();
     }
     // Admin - End
     // Post Types - Start
     require_once 'classes/class-starter-plugin-post-type.php';
     require_once 'classes/class-starter-plugin-taxonomy.php';
     // Register an example post type. To register other post types, duplicate this line.
     $this->post_types['thing'] = new Starter_Plugin_Post_Type('thing', __('Thing', 'starter-plugin'), __('Things', 'starter-plugin'), array('menu_icon' => 'dashicons-carrot'));
     // Post Types - End
     //Register an example taxonomy. To register more taxonomies, duplicate this line.
     $this->taxonomies['taxonomy'] = new Starter_Plugin_Taxonomy('thing', 'taxonomy_name', __('Taxonomy Name', 'starter-plugin'), __('Taxonomy Names', 'starter-plugin'));
     register_activation_hook(__FILE__, array($this, 'install'));
     add_action('init', array($this, 'load_plugin_textdomain'));
 }