Core post fields directly from WordPress: id // ID of the post post_author // ID of the post author post_date // timestamp in local time post_date_gmt // timestamp in gmt time post_content // Full body of the post post_title // title of the post post_excerpt // excerpt field of the post, caption if attachment post_status // post status: publish, new, pending, draft, auto-draft, future, private, inherit, trash comment_status // comment status: open, closed ping_status // ping/trackback status post_password // password of the post post_name // post slug, string to use in the URL to_ping // to ping ?? pinged // pinged ?? post_modified // timestamp in local time post_modified_gmt // timestatmp in gmt tim post_content_filtered // filtered content ?? post_parent // id of the parent post, if attachment, id of the post that uses this image guid // global unique id of the post menu_order // menu order post_type // type of post: post, page, attachment, or custom string post_mime_type // mime type for attachment posts comment_count // number of comments filter // filter ?? Special MTV fields: post_meta // an array containing all of the meta for this post blogid // id number of the blog this post lives on post_format // the post_format for this post url // attachments only, url of the original uploaded image or whatever thumb_url // attachments only, url of the thumbnail image, if thumbnails are enabled Post object functions password_required() Whether post requires password and correct password has been provided. is_sticky() Check if post is sticky. post_class() Retrieve the classes for the post div as an array. permalink() permalink for this post, from WP get_permalink() categories() returns an array of categories that are associated with this post tags() returns an array of tags that are associated with this post featured_image() Returns a Post object representing the featured image attachments( $extra_query_args ) Returns a PostCollection object representing attachments (gallery images) the_time( $format ) Returns a formatted date string. Works like WordPress's 'the_time'. the_date( $format ) Returns a formatted date string. Works like WordPress's 'the_date'. make_excerpt( $more_text ) Returns a generated excerpt. Simliar to how WordPress makes excerpts in The Loop.
Наследование: extends mtv\models\Model
Пример #1
0
 public function parse(&$postdata)
 {
     # Use the parent parse
     $ret =& parent::parse($postdata);
     # If this isn't an attachment, we haven't found what we're looking for
     if ($ret['post_type'] != "attachment") {
         throw new ModelParseException(__("Post is not an attachment", 'mtv'));
     }
     # Add some special fields depending on the post type
     $ret['url'] = wp_get_attachment_url($ret['id']);
     $ret['thumb_url'] = wp_get_attachment_thumb_url($ret['id']);
     return $ret;
 }