WPDK  1.5.0
WordPress Development Kit
 All Data Structures Files Functions Variables Pages
WPDKPost Class Reference
Inheritance diagram for WPDKPost:
WPDKObject WPDKMail

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...
 

Detailed Description

The WPDKPost class is a WordPress Post as object.

Overview

The WPDKPost class is a wrap of WordPress Post record. In addition this class provides a lot of methods and properties.

Properties naming

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.

Post onfly

Create a virtual post

Author
=undo= info@.nosp@m.wpxt.nosp@m.re.me
Date
2014-01-08
Version
1.0.2

Definition at line 25 of file wpdk-post.php.

Constructor & Destructor Documentation

__construct (   $record = null,
  $post_type = 'page' 
)

Construct.

Create an instance of WPDKPost class

Parameters
string | int | object | null$recordOptional. Post ID, post object, post slug or null
string$post_typeOptional. If $record is a string (slug) then this is the post type where search. Default is 'page'
Returns
WPDKPost

Definition at line 270 of file wpdk-post.php.

Member Function Documentation

delete ( )

Delete.

Delete permately this post from database

Since
0.9 wp_delete_post() with second parameter to TRUE.
Returns
mixed False on failure

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();
Since
1.3.1
Parameters
string$sizeOptional. Size of attachment image
int$indexOptional. Index of image. Default first attach image is returned
Returns
bool|WPDKHTMLTagImg

Definition at line 613 of file wpdk-post.php.

static imageAttachmentsWithID (   $post_id,
  $size = 'full',
  $index = 1 
)
static

Attachment image.

Return the nth instance of WPDKHTMLTagImg class as attachment image in a post.

self::imageFromAttachmentsWithID( 2294, 'thumbnail' )->display();
Since
1.3.1
Parameters
int$post_idPost id
string$sizeOptional. Size of attachment image
int$indexOptional. Index of image. Default first attach image is returned
Returns
bool|WPDKHTMLTagImg

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.

Since
1.3.1
Returns
bool|WPDKHTMLTagImg

Definition at line 693 of file wpdk-post.php.

static imageContentWithID (   $post_id)
static

image in post content

Return an instance of WPDKHTMLTagImg class with the first image found in the post content.

Since
1.3.1
Parameters
int$post_idPost ID
Returns
bool|WPDKHTMLTagImg

Definition at line 708 of file wpdk-post.php.

metaValue (   $meta_key)

Meta value.

Return or set a single post meta value

Since
1.3.1
Parameters
string$meta_keyMeta key

Definition at line 503 of file wpdk-post.php.

metaValues (   $meta_key)

Meta values.

Return o set post meta values

Since
1.3.1
Parameters
string$meta_keyMeta 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.

Since
1.3.1
Parameters
string$sizeOptional. Default 'full'
Returns
bool|WPDKHTMLTagImg

Definition at line 549 of file wpdk-post.php.

static thumbnailWithID (   $post_id,
  $size = 'full' 
)
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.

Since
1.3.1
Parameters
int$post_idPost id
string$sizeOptional. Default 'full'
Returns
bool|WPDKHTMLTagImg

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.

Since
0.9 wp_trash_post()
Returns
mixed False on failure

Definition at line 421 of file wpdk-post.php.

untrash ( )

Set in trash.

Restores a post or page from the Trash

Since
0.9 wp_untrash_post()
Returns
mixed False on failure

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.

Since
0.9 wp_update_post()
Returns
int|WP_Error

Definition at line 453 of file wpdk-post.php.

updateMeta (   $args = array())

Update meta.

Update meta

Since
1.4.20

Definition at line 469 of file wpdk-post.php.

static updateMetaWithID (   $post_id,
  $args = array() 
)
static

Brief.

Update the post meta with post id

Since
1.4.20
Parameters
int$post_idPost ID
array$argsKey value pairs array with meta_key => meta_value

Definition at line 483 of file wpdk-post.php.

Field Documentation

string $__version = '1.0.2'

Version.

Override version

Definition at line 58 of file wpdk-post.php.

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

ID Post.

The post ID

Definition at line 67 of file wpdk-post.php.

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

Ping status.

The ping status, ie. open. Max 20 char

Definition at line 108 of file wpdk-post.php.

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

ID author.

The post author ID

Definition at line 124 of file wpdk-post.php.

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

Content.

The post content

Definition at line 140 of file wpdk-post.php.

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

Date Post.

The Post date

Definition at line 158 of file wpdk-post.php.

string $post_date_gmt

Date post in GMT.

The post date in GMT

Definition at line 166 of file wpdk-post.php.

string $post_excerpt

Excerpt.

The post excerpt

Definition at line 174 of file wpdk-post.php.

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

Modified date.

Modified date

Definition at line 192 of file wpdk-post.php.

string $post_modified_gmt

Modifed date in GMT.

Modifed date in GMT

Definition at line 200 of file wpdk-post.php.

string $post_name

Name.

The post name. Same as post slug. Max 200 char

Definition at line 208 of file wpdk-post.php.

int $post_parent

Parent post.

Parent Post ID

Definition at line 216 of file wpdk-post.php.

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

Status.

Post status, ie. publish, draft. Max 20 char

Definition at line 232 of file wpdk-post.php.

string $post_title

Title.

The post title

Definition at line 240 of file wpdk-post.php.

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.


The documentation for this class was generated from the following file: