/** * Get the post object representing this View. * * @return WP_Post Post object. * * @throws InvalidArgumentException if the post object cannot be retrieved or is invalid. */ protected function &post() { if( null == $this->post ) { // Requesting WP_Post object, but we haven't got it yet. $post = WP_Post::get_instance( $this->object_id ); if( WPV_View_Base::is_wppost_view( $post ) ) { $this->post = $post; } else { throw new InvalidArgumentException( 'Invalid View ID' ); } } return $this->post; }