public function __construct($name, $singular = null, $plural = null, $supports = array('title', 'editor'))
 {
     $this->name = $name;
     $this->singular = $singular ?: ucwords($name);
     $this->plural = $plural ?: $this->singular . 's';
     $this->supports = $supports;
     CustomPostTypes::addCustomPostType($this);
     add_action('init', array($this, 'createPostType'));
 }
 public static function find($postType)
 {
     $customPostTypes = CustomPostTypes::Get();
     foreach ($customPostTypes->list as $customKey => $customPost) {
         if ($postType == $customKey) {
             return $customPost;
         }
     }
     return null;
 }
Example #3
0
 public function __construct($id, $title, $postType = 'page', $template = array())
 {
     $this->id = $id;
     $this->title = $title;
     $this->postType = $postType;
     $this->template = (array) $template;
     if ($customPostType = CustomPostTypes::Find($postType)) {
         $customPostType->addMetaBox($this);
     }
     add_action('admin_enqueue_scripts', array($this, 'insertScripts'));
 }