Property | Type | Description | |
---|---|---|---|
$ID | integer | The post ID | |
$__version | string | Override version | |
$comment_count | integer | Number of comments, pings, and trackbacks combined | |
$comment_status | string | The comment status, ie. open. Max 20 char | |
$guid | string | The guid. Global Unique Identifier. The “real” URL to the post, not the permalink version. For pages, this is the actual URL. In the case of files (attachments), this holds the URL to the file. | |
$menu_order | integer | Holds values for display order of pages. Only works with pages, not posts. | |
$ping_status | string | The ping status, ie. open. Max 20 char | |
$pinged | array | List of urls that have been pinged (for published posts) | |
$post_author | integer | The post author ID | |
$post_category | integer | Number representing post category ID#. This property is not present on databse record. | |
$post_content | string | The post content | |
$post_content_filtered | string | If you’ve got a plugin that runs a very resource heavy filter on content, you might consider caching the results with post_content_filtered, and calling that from the front end instead. | |
$post_date | string | The Post date | |
$post_date_gmt | string | The post date in GMT | |
$post_excerpt | string | The post excerpt | |
$post_meta | array | A key values pair array with the list of post meta for this post. | |
$post_mime_type | string | Typical values are: text/html, image/png, image/jpg | |
$post_modified | string | Modified date | |
$post_modified_gmt | string | Modifed date in GMT | |
$post_name | string | The post name. Same as post slug. Max 200 char | |
$post_parent | integer | Parent Post ID | |
$post_password | string | Protect post password. Will be empty if no password. Max 20 char | |
$post_status | string | Post status, ie. publish, draft. Max 20 char | |
$post_title | string | The post title | |
$post_type | string | The post type. Used by Custom Post. Default 'post'. Self-explanatory for pages and posts. Any files uploaded are attachments and post revisions saved as revision | |
$to_ping | array | List of urls to ping when post is published (for unpublished posts) |
Method | Description | |
---|---|---|
__construct ( string | integer | object | null $record = null, string $post_type = WPDKPostType::POST ) : WPDKPost | Create an instance of WPDKPost class | |
delete ( ) : mixed | Delete permately this post from database | |
duplicate ( string | integer | object $post, array $args = [] ) : WPDKPost | Return an instance of WPDKPost as clone of input post. The new 'duplicate' post is stored on db. | |
imageAttachments ( string $size = 'full', integer $index = 1 ) : boolean | WPDKHTMLTagImg | Return the nth instance of WPDKHTMLTagImg class as attachment image in this post. | |
imageAttachmentsWithID ( integer $post_id, string $size = 'full', integer $index = 1 ) : boolean | WPDKHTMLTagImg | Return the nth instance of WPDKHTMLTagImg class as attachment image in a post. | |
imageContent ( ) : boolean | WPDKHTMLTagImg | Return an instance of WPDKHTMLTagImg class with the first image found in this post content. | |
imageContentWithID ( integer $post_id ) : boolean | WPDKHTMLTagImg | Return an instance of WPDKHTMLTagImg class with the first image found in the post content. | |
insert ( ) : integer | WP_Error | Insert or update a post. | |
metaValue ( string $meta_key ) : boolean | mixed | Return or set a single post meta value | |
metaValues ( string $meta_key ) : boolean | mixed | Return o set post meta values | |
publish ( ) : integer | WP_Error | Publish a post. | |
thumbnail ( string $size = 'full' ) : boolean | WPDKHTMLTagImg | Return an instance of WPDKHTMLTagImg class with thumbmail image description. If the thumbnail is not found return FALSE. You can use the WPDKHTMLTagImg instance to read the property, get the HTML markup or display the image. | |
thumbnailWithID ( integer $post_id, string $size = 'full' ) : boolean | WPDKHTMLTagImg | Return an instance of WPDKHTMLTagImg class with thumbmail image description. If the thumbnail is not found return FALSE. You can use the WPDKHTMLTagImg instance to read the property, get the HTML markup or display the image. | |
trash ( ) : mixed | Moves a post or page to the Trash If trash is disabled, the post or page is permanently deleted. | |
untrash ( ) : mixed | Restores a post or page from the Trash | |
update ( ) : integer | WP_Error | Update this post on database. Also this method check if you are in admin backend area for this custom post. | |
updateMeta ( array $args = [] ) | Update meta | |
updateMetaWithID ( integer $post_id, array $args = [] ) | Update the post meta with post id |
Method | Description | |
---|---|---|
initPostByArgs ( array | object $args ) | Init this instance of WPDKPost as a empty Post | |
initPostByID ( integer $id_post ) | Init this instance of WPDKPost as post from Post ID | |
initPostByPost ( object $post ) | Init this instance of WPDKPost as post from Post database object | |
postEmpty ( ) : array | Return a Key value pairs array with property and value for an empty post. The properties are set to a default values. |
public __construct ( string | integer | object | null $record = null, string $post_type = WPDKPostType::POST ) : WPDKPost | ||
$record | string | integer | object | null | Optional. Post ID, post object, post slug or null |
$post_type | string | Optional. If $record is a string (slug) then this is the post type where search. Default is 'page' |
return | WPDKPost |
public static imageAttachmentsWithID ( integer $post_id, string $size = 'full', integer $index = 1 ) : boolean | WPDKHTMLTagImg | ||
$post_id | integer | Post id |
$size | string | Optional. Size of attachment image |
$index | integer | Optional. Index of image. Default first attach image is returned |
return | boolean | WPDKHTMLTagImg |
public imageContent ( ) : boolean | WPDKHTMLTagImg | ||
return | boolean | WPDKHTMLTagImg |
public static imageContentWithID ( integer $post_id ) : boolean | WPDKHTMLTagImg | ||
$post_id | integer | Post ID |
return | boolean | WPDKHTMLTagImg |
public static updateMetaWithID ( integer $post_id, array $args = [] ) | ||
$post_id | integer | Post ID |
$args | array | Key value pairs array with meta_key => meta_value |
public int $comment_count | ||
return | integer |
public string $comment_status | ||
return | string |
public string $guid | ||
return | string |
public string $ping_status | ||
return | string |
public array $pinged | ||
return | array |
public int $post_category | ||
return | integer |
public string $post_content_filtered | ||
return | string |
public array $post_meta | ||
return | array |
public string $post_mime_type | ||
return | string |
public string $post_modified_gmt | ||
return | string |
public string $post_name | ||
return | string |
public string $post_password | ||
return | string |
public string $post_status | ||
return | string |
public string $post_type | ||
return | string |
public array $to_ping | ||
return | array |