WPDK
1.5.0
WordPress Development Kit
|
Public Member Functions | |
__construct ($record=null, $post_type= 'page') | |
Construct. More... | |
delete () | |
Delete. More... | |
trash () | |
Set in trash. More... | |
untrash () | |
Set in trash. More... | |
update () | |
Update. More... | |
updateMeta ($args=array()) | |
Update meta. More... | |
metaValue ($meta_key) | |
Meta value. More... | |
metaValues ($meta_key) | |
Meta values. More... | |
thumbnail ($size= 'full') | |
Get thumbnail image. More... | |
imageAttachments ($size= 'full', $index=1) | |
Attachment image. More... | |
imageContent () | |
image in post content More... | |
Public Member Functions inherited from WPDKObject | |
__className () | |
Returns the class object. More... | |
__parentClass () | |
Returns the class object for the receiver’s superclass. More... | |
__isClass ($class) | |
Brief. More... | |
__isSubclassOfClass ($class) | |
Return TRUE if the receiving class is a subclass of —or identical to— $class, otherwise FALSE. More... | |
Static Public Member Functions | |
static | updateMetaWithID ($post_id, $args=array()) |
Brief. More... | |
static | thumbnailWithID ($post_id, $size= 'full') |
Get thumbnail image. More... | |
static | imageAttachmentsWithID ($post_id, $size= 'full', $index=1) |
Attachment image. More... | |
static | imageContentWithID ($post_id) |
image in post content More... | |
Static Public Member Functions inherited from WPDKObject | |
static | __delta ($last_version, $old_version) |
Object delta compare for combine. More... | |
static | delta ($last_version, $old_version) |
static | __dump ($var, $monitor=false) |
Dump a variable. More... | |
Data Fields | |
const | COLUMN_COMMENT_COUNT = 'comment_count' |
const | COLUMN_COMMENT_STATUS = 'comment_status' |
const | COLUMN_GUID = 'guid' |
const | COLUMN_ID = 'ID' |
const | COLUMN_MENU_ORDER = 'menu_order' |
const | COLUMN_PINGED = 'pinged' |
const | COLUMN_PING_STATUS = 'ping_status' |
const | COLUMN_POST_AUTHOR = 'post_author' |
const | COLUMN_POST_CONTENT = 'post_content' |
const | COLUMN_POST_CONTENT_FILTERED = 'post_content_filtered' |
const | COLUMN_POST_DATE = 'post_date' |
const | COLUMN_POST_DATE_GMT = 'post_date_gmt' |
const | COLUMN_POST_EXCERPT = 'post_excerpt' |
const | COLUMN_POST_MIME_TYPE = 'post_mime_type' |
const | COLUMN_POST_MODIFIED = 'post_modified' |
const | COLUMN_POST_MODIFIED_GMT = 'post_modified_gmt' |
const | COLUMN_POST_NAME = 'post_name' |
const | COLUMN_POST_PARENT = 'post_parent' |
const | COLUMN_POST_PASSWORD = 'post_password' |
const | COLUMN_POST_STATUS = 'post_status' |
const | COLUMN_POST_TITLE = 'post_title' |
const | COLUMN_POST_TYPE = 'post_type' |
const | COLUMN_TO_PING = 'to_ping' |
$__version = '1.0.2' | |
Version. More... | |
$ID | |
ID Post. More... | |
$comment_count | |
Comment count. More... | |
$comment_status | |
Comment status. More... | |
$guid | |
GUID. More... | |
$menu_order | |
Menu order. More... | |
$ping_status | |
Ping status. More... | |
$pinged | |
List of pinged urls. More... | |
$post_author | |
ID author. More... | |
$post_category | |
Category ID. More... | |
$post_content | |
Content. More... | |
$post_content_filtered | |
Content filtered. More... | |
$post_date | |
Date Post. More... | |
$post_date_gmt | |
Date post in GMT. More... | |
$post_excerpt | |
Excerpt. More... | |
$post_mime_type | |
Mime type. More... | |
$post_modified | |
Modified date. More... | |
$post_modified_gmt | |
Modifed date in GMT. More... | |
$post_name | |
Name. More... | |
$post_parent | |
Parent post. More... | |
$post_password | |
Password. More... | |
$post_status | |
Status. More... | |
$post_title | |
Title. More... | |
$post_type | |
Type. More... | |
$to_ping | |
List ping urls. More... | |
Data Fields inherited from WPDKObject | |
$__version = '1.0.0' | |
The version number assigned to the class. More... | |
The WPDKPost class is a WordPress Post as object.
The WPDKPost class is a wrap of WordPress Post record. In addition this class provides a lot of methods and properties.
You'll see that a lot of properties class are written in lowercase and underscore mode as $post_date
. This beacouse they are a map of database record.
Definition at line 25 of file wpdk-post.php.
__construct | ( | $record = null , |
|
$post_type = 'page' |
|||
) |
Construct.
Create an instance of WPDKPost class
string | int | object | null | $record | Optional. Post ID, post object, post slug or null |
string | $post_type | Optional. If $record is a string (slug) then this is the post type where search. Default is 'page' |
Definition at line 270 of file wpdk-post.php.
delete | ( | ) |
Delete.
Delete permately this post from database
Definition at line 405 of file wpdk-post.php.
imageAttachments | ( | $size = 'full' , |
|
$index = 1 |
|||
) |
Attachment image.
Return the nth instance of WPDKHTMLTagImg class as attachment image in this post.
self::imageFromAttachmentsWithID( 2294, 'thumbnail' )->display();
string | $size | Optional. Size of attachment image |
int | $index | Optional. Index of image. Default first attach image is returned |
Definition at line 613 of file wpdk-post.php.
|
static |
Attachment image.
Return the nth instance of WPDKHTMLTagImg class as attachment image in a post.
self::imageFromAttachmentsWithID( 2294, 'thumbnail' )->display();
int | $post_id | Post id |
string | $size | Optional. Size of attachment image |
int | $index | Optional. Index of image. Default first attach image is returned |
Definition at line 632 of file wpdk-post.php.
imageContent | ( | ) |
image in post content
Return an instance of WPDKHTMLTagImg class with the first image found in this post content.
Definition at line 693 of file wpdk-post.php.
|
static |
image in post content
Return an instance of WPDKHTMLTagImg class with the first image found in the post content.
int | $post_id | Post ID |
Definition at line 708 of file wpdk-post.php.
metaValue | ( | $meta_key | ) |
Meta value.
Return or set a single post meta value
string | $meta_key | Meta key |
Definition at line 503 of file wpdk-post.php.
metaValues | ( | $meta_key | ) |
Meta values.
Return o set post meta values
string | $meta_key | Meta key |
Definition at line 526 of file wpdk-post.php.
thumbnail | ( | $size = 'full' | ) |
Get thumbnail image.
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.
string | $size | Optional. Default 'full' |
Definition at line 549 of file wpdk-post.php.
|
static |
Get thumbnail image.
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.
int | $post_id | Post id |
string | $size | Optional. Default 'full' |
Definition at line 566 of file wpdk-post.php.
trash | ( | ) |
Set in trash.
Moves a post or page to the Trash If trash is disabled, the post or page is permanently deleted.
Definition at line 421 of file wpdk-post.php.
untrash | ( | ) |
Set in trash.
Restores a post or page from the Trash
Definition at line 436 of file wpdk-post.php.
update | ( | ) |
Update.
Update this post on database. Also this method check if you are in admin backend area for this custom post. In this case the post update if turn off and save the post meta only. Return value 0 or WP_Error on failure. The post ID on success.
Definition at line 453 of file wpdk-post.php.
updateMeta | ( | $args = array() | ) |
|
static |
Brief.
Update the post meta with post id
int | $post_id | Post ID |
array | $args | Key value pairs array with meta_key => meta_value |
Definition at line 483 of file wpdk-post.php.
string $__version = '1.0.2' |
int $comment_count |
Comment count.
Number of comments, pings, and trackbacks combined
Definition at line 75 of file wpdk-post.php.
string $comment_status |
Comment status.
The comment status, ie. open. Max 20 char
Definition at line 83 of file wpdk-post.php.
string $guid |
GUID.
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.
Definition at line 92 of file wpdk-post.php.
int $ID |
int $menu_order |
Menu order.
Holds values for display order of pages. Only works with pages, not posts.
Definition at line 100 of file wpdk-post.php.
string $ping_status |
array $pinged |
List of pinged urls.
List of urls that have been pinged (for published posts)
Definition at line 116 of file wpdk-post.php.
int $post_author |
int $post_category |
Category ID.
Number representing post category ID#. This property is not present on databse record.
Definition at line 132 of file wpdk-post.php.
string $post_content |
string $post_content_filtered |
Content filtered.
Exists to store a cached version of post content (most likely with all the the_content filters already applied). 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.
Definition at line 150 of file wpdk-post.php.
string $post_date |
string $post_date_gmt |
string $post_excerpt |
string $post_mime_type |
Mime type.
The post mime type. Only used for files (attachments). Contains the MIME type of the uploaded file. Typical values are: text/html, image/png, image/jpg
Definition at line 184 of file wpdk-post.php.
string $post_modified |
string $post_modified_gmt |
string $post_name |
int $post_parent |
string $post_password |
Password.
Protect post password. Will be empty if no password. Max 20 char
Definition at line 224 of file wpdk-post.php.
string $post_status |
string $post_title |
string $post_type |
Type.
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
Definition at line 249 of file wpdk-post.php.
array $to_ping |
List ping urls.
List of urls to ping when post is published (for unpublished posts)
Definition at line 257 of file wpdk-post.php.
const COLUMN_COMMENT_COUNT = 'comment_count' |
Definition at line 27 of file wpdk-post.php.
const COLUMN_COMMENT_STATUS = 'comment_status' |
Definition at line 28 of file wpdk-post.php.
const COLUMN_GUID = 'guid' |
Definition at line 29 of file wpdk-post.php.
const COLUMN_ID = 'ID' |
Definition at line 30 of file wpdk-post.php.
const COLUMN_MENU_ORDER = 'menu_order' |
Definition at line 31 of file wpdk-post.php.
const COLUMN_PING_STATUS = 'ping_status' |
Definition at line 33 of file wpdk-post.php.
const COLUMN_PINGED = 'pinged' |
Definition at line 32 of file wpdk-post.php.
const COLUMN_POST_AUTHOR = 'post_author' |
Definition at line 34 of file wpdk-post.php.
const COLUMN_POST_CONTENT = 'post_content' |
Definition at line 35 of file wpdk-post.php.
const COLUMN_POST_CONTENT_FILTERED = 'post_content_filtered' |
Definition at line 36 of file wpdk-post.php.
const COLUMN_POST_DATE = 'post_date' |
Definition at line 37 of file wpdk-post.php.
const COLUMN_POST_DATE_GMT = 'post_date_gmt' |
Definition at line 38 of file wpdk-post.php.
const COLUMN_POST_EXCERPT = 'post_excerpt' |
Definition at line 39 of file wpdk-post.php.
const COLUMN_POST_MIME_TYPE = 'post_mime_type' |
Definition at line 40 of file wpdk-post.php.
const COLUMN_POST_MODIFIED = 'post_modified' |
Definition at line 41 of file wpdk-post.php.
const COLUMN_POST_MODIFIED_GMT = 'post_modified_gmt' |
Definition at line 42 of file wpdk-post.php.
const COLUMN_POST_NAME = 'post_name' |
Definition at line 43 of file wpdk-post.php.
const COLUMN_POST_PARENT = 'post_parent' |
Definition at line 44 of file wpdk-post.php.
const COLUMN_POST_PASSWORD = 'post_password' |
Definition at line 45 of file wpdk-post.php.
const COLUMN_POST_STATUS = 'post_status' |
Definition at line 46 of file wpdk-post.php.
const COLUMN_POST_TITLE = 'post_title' |
Definition at line 47 of file wpdk-post.php.
const COLUMN_POST_TYPE = 'post_type' |
Definition at line 48 of file wpdk-post.php.
const COLUMN_TO_PING = 'to_ping' |
Definition at line 49 of file wpdk-post.php.