Skip to content

MizzouPost

Paul Gilzow edited this page Oct 18, 2018 · 2 revisions

Note that "post" as written below refer to a "post", a "page" or a custom post type equally.

In a view (.twig) you'll most likely access a MizzouPost object as the token Post or MainPost. This is the default from the framework but can be overridden changed by any downstream controllers (parent/child themes). In addition, when dealing with custom post types (CPT), it's entirely possible the controller will name those tokens after the CPT (e.g. Person, Book, Report, etc.). However, every CPT based off of MizzouPost should contain these same properties.

Contains all of the public properties from the WP_Post object (with the exception of post_name) reformatted as follows:

  • author - the post author's user ID (numeric string)
  • post_name - the post's slug. We've removed it and instead use the property slug
  • type - the post's post type
  • title_raw - title of the post with the_title filter applied
  • date - date the post was published in format: 0000-00-00 00:00:00
  • date_gmt - gmt date the post was published in format: 0000-00-00 00:00:00
  • content_raw - The full content of the post, but without the_content filter applied
  • excerpt - user-defined post excerpt, OR shortened excerpt from content_raw with shortcodes removed
  • status - see get_post_status for values
  • comment_status - post's comment status. Will be either "open" or "closed"
  • ping_status - post's ping status. Will be either "open" or "closed"
  • password - post's password if set, will return empty string if no password
  • parent - parent post's ID
  • modified - post's last modified date in format : 0000-00-00 00:00:00
  • modified_gmt - post's last modified gmt date in format : 0000-00-00 00:00:00
  • comment_count - number of comments on post (numeric string)
  • menu_order - order value as set through page-attribute when enabled (numeric string. Defaults to 0)

Then we add the following properties

  • timestamp - timestamp as derived from date above
  • title - the post's title with the the_title filter applied
  • content - the post's content with the the_content filter applied
  • permalink - the post's canonical URL
  • post_format - the post's post format
  • iso8601_date - post's is08601 (date "c") date
  • hasFeaturedImage
  • ancestors

Clone this wiki locally