Post.php
599 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
namespace AC\Relation;
use AC\Relation;
use WP_Post_Type;
class Post extends Relation {
/**
* @var object
*/
private $post_type_object;
public function __construct( $id ) {
parent::__construct( $id );
$this->post_type_object = get_post_type_object( $this->get_id() );
}
public function get_type() {
return 'post';
}
/**
* @return WP_Post_Type
*/
public function get_post_type_object() {
return $this->post_type_object;
}
public function get_labels() {
if ( ! $this->post_type_object ) {
return false;
}
return $this->post_type_object->labels;
}
}