public function type() { if (isset($this->custom['type'])) { return $this->custom['type']; } if (!$this->__type instanceof PostType) { $this->__type = new PostType($this->post_type); } return $this->__type; }