abstract class Post

A class to represent and help deal with common custom post type functionality.

Properties

protected WP_Post $Post
protected array $Meta

Methods

static 
post_type()

Get the post type of the Post.

WP_Post
get_post()

Returns the parent WP_Post object.

int
get_ID()

Returns the ID of the parent WP_Post.

string
get_title()

Returns the title of the parent WP_Post.

null|Post_Meta
get_meta(string $meta_key = '')

Returns the Post meta.

__construct(int|WP_Post $id)

Construct the Post. Load Post and Post Meta data.

add_meta(Post_Meta $Meta)

Add a Post Meta to this Post.

Details

at line 36
abstract static post_type()

Get the post type of the Post.

at line 43
final WP_Post get_post()

Returns the parent WP_Post object.

Return Value

WP_Post

The parent Post object.

at line 50
final int get_ID()

Returns the ID of the parent WP_Post.

Return Value

int

The ID of the parent WP_Post object.

at line 57
final string get_title()

Returns the title of the parent WP_Post.

Return Value

string

The title of the parent WP_Post object.

at line 66
final null|Post_Meta get_meta(string $meta_key = '')

Returns the Post meta.

Parameters

string $meta_key

The meta key of the Meta to return.

Return Value

null|Post_Meta

The Post meta if found or NULL.

at line 87
__construct(int|WP_Post $id)

Construct the Post. Load Post and Post Meta data.

Parameters

int|WP_Post $id

The \WP_Post object, or the ID to one.

at line 125
final protected add_meta(Post_Meta $Meta)

Add a Post Meta to this Post.

Parameters

Post_Meta $Meta