프로퍼티 | 타입 | 설명 | |
---|---|---|---|
$ID | string | the numeric WordPress id of a post, capitalized to match WP usage | |
$ImageClass | string | the name of the class to handle images by default | |
$PostClass | string | the name of the class to handle posts by default | |
$TermClass | string | the name of the class to handle terms by default | |
$class | string | stores the CSS classes for the post (ex: "post post-type-book post-123") | |
$id | string | the numeric WordPress id of a post | |
$object_type | string | what does this class represent in WordPress terms? | |
$post_author | integer | the numeric ID of the a post's author corresponding to the wp_user dtable | |
$post_content | string | the raw text of a WP post as stored in the database | |
$post_date | string | the raw date string as stored in the WP database, ex: 2014-07-05 18:01:39 | |
$post_excerpt | string | the raw text of a manual post excerpt as stored in the database | |
$post_parent | integer | the numeric ID of a post's parent post | |
$post_status | string | the status of a post ("draft", "publish", etc.) | |
$post_title | string | the raw text of a post's title as stored in the database | |
$post_type | string | the name of the post type, this is the machine name (so "my_custom_post_type" as opposed to "My Custom Post Type") | |
$representation | string | what does this class represent in WordPress terms? | |
$slug | string | the URL-safe slug, this corresponds to the poorly-named "post_name" in the WP database, ex: "hello-world" |
프로퍼티 | 타입 | 설명 | |
---|---|---|---|
$__type | Timber\PostType | ||
$_content | string | stores the processed content internally | |
$_next | array | stores the results of the next Timber\Post in a set inside an array (in order to manage by-taxonomy) | |
$_permalink | string | the returned permalink from WP's get_permalink function | |
$_prev | array | stores the results of the previous Timber\Post in a set inside an array (in order to manage by-taxonomy) |
메소드 | 설명 | |
---|---|---|
__construct ( mixed $pid = null ) | If you send the constructor nothing it will try to figure out the current post id based on being inside The_Loop | |
__toString ( ) : string |
Outputs the title of the post if you do something like {{post}} |
|
author ( ) : |
Return the author of a post | |
authors ( ) | ||
categories ( ) : array | Get the categoires on a particular post | |
category ( ) : TimberTerm | null | Returns a category attached to a post | |
children ( string | array $post_type = 'any', string | boolean $childPostClass = false ) : array | Returns an array of children on the post as Timber\Posts (or other claass as you define). | |
comment_form ( array $args = [] ) : string | Gets the comment form for use on a single article page | |
comments ( integer $count, string $order = 'wp', string $type = 'comment', string $status = 'approve', string $CommentClass = 'Timber\Comment' ) : boolean | array | Gets the comments on a Timber\Post and returns them as an array of TimberComments (or whatever comment class you set). | |
content ( integer $page, $len ) : string | Gets the actual content of a WP Post, as opposed to post_content this will run the hooks/filters attached to the_content. \This guy will return your posts content with WordPress filters run on it (like for shortcodes and wpautop). | |
convert ( array $data, string $class ) | Finds any WP_Post objects and converts them to Timber\Posts | |
date ( string $date_format = '' ) : string | Get the date to use in your template! | |
edit_link ( ) : boolean | string | Returns the edit URL of a post if the user has access to it | |
format ( ) : mixed | ||
get_author ( ) : |
Gets a User object from the author of the post | |
get_categories ( ) : array | Get the categories for a post | |
get_category ( ) : mixed | ||
get_children ( string $post_type = 'any', boolean | string $childPostClass = false ) : array | ||
get_comment_count ( ) : integer | ||
get_comments ( integer $count, string $order = 'wp', string $type = 'comment', string $status = 'approve', string $CommentClass = 'Timber\Comment' ) : array | mixed | Get the comments for a post | |
get_content ( integer $len, integer $page ) : string | Displays the content of the post with filters, shortcodes and wpautop applied | |
get_date ( string $date_format = '' ) : string | ||
get_edit_url ( ) : boolean | string | Get the URL that will edit the current post/object | |
get_field ( string $field_name ) : mixed | ||
get_format ( ) : mixed | ||
get_image ( string $field ) : TimberImage | ||
get_link ( ) : string | get the permalink for a post object In your templates you should use link: Read my post | |
get_method_values ( ) : array | ||
get_modified_author ( ) : |
||
get_modified_date ( string $date_format = '' ) : string | ||
get_modified_time ( string $time_format = '' ) : string | ||
get_next ( boolean $taxonomy = false ) : TimberPost | boolean | Get the next post in WordPress's ordering | |
get_paged_content ( ) : string | ||
get_pagination ( ) : array | Get a data array of pagination so you can navigate to the previous/next for a paginated post | |
get_parent ( ) : boolean | TimberPost | Get the parent post of the post | |
get_path ( ) : string | Get the permalink for a post, but as a relative path For example, where {{post.link}} would return "http://example.org/2015/07/04/my-cool-post" this will return the relative version: "/2015/07/04/my-cool-post" | |
get_permalink ( ) : string | ||
get_post_id_by_name ( string $post_name ) : integer | get_post_id_by_name($post_name) | |
get_post_type ( ) : Timber\PostType | Returns the post_type object with labels and other info | |
get_prev ( $in_same_term = false ) : TimberPost | boolean | Get the next post in WordPress's ordering | |
get_preview ( integer $len = 50, boolean $force = false, string $readmore = 'Read More', boolean | string $strip = true, string $end = '…' ) : string | get a preview of your post, if you have an excerpt it will use that, otherwise it will pull from the post_content. | |
get_tags ( ) : array | Gets an array of tags for you to use | |
get_terms ( string | array $tax = '', boolean $merge = true, $TermClass = '' ) : array | Get the terms associated with the post This goes across all taxonomies by default | |
get_thumbnail ( ) : Timber\Image | null | ||
get_title ( ) : string | Outputs the title with filters applied | |
has_field ( string $field_name ) : boolean | ||
has_term ( string | integer $term_name_or_id, string $taxonomy = 'all' ) : boolean | ||
import_custom ( integer $pid ) | gets the post custom and attaches it to the current object | |
import_field ( string $field_name ) | ||
link ( ) : string | get the permalink for a post object | |
meta ( string $field_name = null ) : mixed | ||
modified_author ( ) : |
Get the author (WordPress user) who last modified the post | |
modified_date ( string $date_format = '' ) : string | ||
modified_time ( string $time_format = '' ) : string | ||
name ( ) : string | ||
next ( boolean $in_same_term = false ) : mixed | ||
paged_content ( ) : string | ||
pagination ( ) : array | Get a data array of pagination so you can navigate to the previous/next for a paginated post | |
parent ( ) : boolean | Timber\Post | Gets the parent (if one exists) from a post as a Timber\Post object (or whatever is set in Timber\Post::$PostClass) | |
password_required ( ) : boolean | whether post requires password and correct password has been provided | |
path ( ) : string | Gets the relative path of a WP Post, so while link() will return http://example.org/2015/07/my-cool-post this will return just /2015/07/my-cool-post | |
permalink ( ) : string | ||
post_class ( string $class = '' ) : string | Get the CSS classes for a post. For usage you should use {{post.class}} instead of {{post.post_class}} | |
prev ( boolean $in_same_term = false ) : mixed | Get the previous post in a set | |
preview ( ) : |
||
tags ( ) : array | Gets the tags on a post, uses WP's post_tag taxonomy | |
terms ( string | array $tax = '', boolean $merge = true, $TermClass = '' ) : array | Get the terms associated with the post This goes across all taxonomies by default | |
thumbnail ( ) : TimberImage | null | get the featured image as a TimberImage | |
time ( string $time_format = '' ) : string | Get the time to use in your template | |
title ( ) : string | Returns the processed title to be used in templates. This returns the title of the post after WP's filters have run. This is analogous to the_title() in standard WP template tags. | |
type ( ) : Timber\PostType | Returns the post_type object with labels and other info | |
update ( string $field, mixed $value ) | updates the post_meta of the current object with the given value |
메소드 | 설명 | |
---|---|---|
check_post_id ( integer $pid ) : integer | helps you find the post id regardless of whether you send a string or whatever | |
determine_id ( $pid ) : integer | tries to figure out what post you want to get if not explictly defined (or if it is, allows it to be passed through) | |
get_info ( integer $pid ) : null | object | WP_Pos\WP_Post | Used internally by init, etc. to build TimberPost object | |
get_post_custom ( integer $pid ) : array | Used internally to fetch the metadata fields (wp_postmeta table) and attach them to our TimberPost object | |
get_post_preview_id ( $query ) | ||
get_wp_link_page ( integer $i ) : string | ||
init ( integer $pid = false ) | Initializes a Post | |
maybe_show_password_form ( ) : string | void | If the Password form is to be shown, show it! | |
prepare_post_info ( integer $pid ) : WP_Pos\WP_Post | takes a mix of integer (post ID), string (post slug), or object to return a WordPress post object from WP's built-in get_post() function |
public __construct ( mixed $pid = null ) | ||
$pid | mixed |
public __toString ( ) : string | ||
리턴 | string |
public categories ( ) : array | ||
리턴 | array | of TimberTerms |
protected check_post_id ( integer $pid ) : integer | ||
$pid | integer | ; |
리턴 | integer | ID number of a post |
public children ( string | array $post_type = 'any', string | boolean $childPostClass = false ) : array | ||
$post_type | string | array | _optional_ use to find children of a particular post type (attachment vs. page for example). You might want to restrict to certain types of children in case other stuff gets all mucked in there. You can use 'parent' to use the parent's post type or you can pass an array of post types. |
$childPostClass | string | boolean | _optional_ a custom post class (ex: 'MyTimber\Post') to return the objects as. By default (false) it will use Timber\Post::$post_class value. |
리턴 | array |
public comment_form ( array $args = [] ) : string | ||
$args | array | this $args thing is a fucking mess, [fix at some point](http://codex.wordpress.org/Function_Reference/comment_form) |
리턴 | string | of HTML for the form |
public comments ( integer $count, string $order = 'wp', string $type = 'comment', string $status = 'approve', string $CommentClass = 'Timber\Comment' ) : boolean | array | ||
$count | integer | Set the number of comments you want to get. `0` is analogous to "all" |
$order | string | use ordering set in WordPress admin, or a different scheme |
$type | string | For when other plugins use the comments table for their own special purposes, might be set to 'liveblog' or other depending on what's stored in yr comments table |
$status | string | Could be 'pending', etc. |
$CommentClass | string | What class to use when returning Comment objects. As you become a Timber pro, you might find yourself extending TimberComment for your site or app (obviously, totally optional) |
리턴 | boolean | array |
protected determine_id ( $pid ) : integer | ||
리턴 | integer | the numberic id we should be using for this post object |
public get_author ( ) : |
||
리턴 |
public get_categories ( ) : array | ||
리턴 | array | of TimberTerms |
public get_comment_count ( ) : integer | ||
리턴 | integer | the number of comments on a post |
public get_edit_url ( ) : boolean | string | ||
리턴 | boolean | string |
public get_modified_date ( string $date_format = '' ) : string | ||
$date_format | string | |
리턴 | string |
public get_modified_time ( string $time_format = '' ) : string | ||
$time_format | string | |
리턴 | string |
public get_pagination ( ) : array | ||
리턴 | array |
public get_parent ( ) : boolean | TimberPost | ||
리턴 | boolean | TimberPost |
protected get_post_custom ( integer $pid ) : array | ||
$pid | integer | |
리턴 | array |
public static get_post_id_by_name ( string $post_name ) : integer | ||
$post_name | string | |
리턴 | integer |
public get_post_type ( ) : Timber\PostType | ||
리턴 | Timber\PostType |
public get_preview ( integer $len = 50, boolean $force = false, string $readmore = 'Read More', boolean | string $strip = true, string $end = '…' ) : string | ||
$len | integer | The number of words that WP should use to make the tease. (Isn't this better than [this mess](http://wordpress.org/support/topic/changing-the-default-length-of-the_excerpt-1?replies=14)?). If you've set a post_excerpt on a post, we'll use that for the preview text; otherwise the first X words of the post_content |
$force | boolean | What happens if your custom post excerpt is longer then the length requested? By default (`$force = false`) it will use the full `post_excerpt`. However, you can set this to true to *force* your excerpt to be of the desired length |
$readmore | string | The text you want to use on the 'readmore' link |
$strip | boolean | string | true for default, false for none, string for list of custom attributes |
$end | string | The text to end the preview with (defaults to ...) |
리턴 | string | of the post preview |
public get_terms ( string | array $tax = '', boolean $merge = true, $TermClass = '' ) : array | ||
$tax | string | array | What taxonom(y|ies) to pull from. Defaults to all registered taxonomies for the post type. You can use custom ones, or built-in WordPress taxonomies (category, tag). Timber plays nice and figures out that tag/tags/post_tag are all the same (and categories/category), for custom taxonomies you're on your own. |
$merge | boolean | Should the resulting array be one big one (true)? Or should it be an array of sub-arrays for each taxonomy (false)? |
리턴 | array |
protected static get_wp_link_page ( integer $i ) : string | ||
$i | integer | |
리턴 | string |
public import_custom ( integer $pid ) | ||
$pid | integer | a post ID number |
protected maybe_show_password_form ( ) : string | void | ||
리턴 | string | void |
public modified_author ( ) : |
||
리턴 | A User object if found, false if not |
public modified_date ( string $date_format = '' ) : string | ||
$date_format | string | |
리턴 | string |
public modified_time ( string $time_format = '' ) : string | ||
$time_format | string | |
리턴 | string |
public pagination ( ) : array | ||
리턴 | array |
public password_required ( ) : boolean | ||
리턴 | boolean |
public post_class ( string $class = '' ) : string | ||
$class | string | additional classes you want to add |
리턴 | string | a space-seperated list of classes |
protected prepare_post_info ( integer $pid ) : WP_Pos\WP_Post | ||
$pid | integer | |
리턴 | WP_Pos\WP_Post | on success |
public terms ( string | array $tax = '', boolean $merge = true, $TermClass = '' ) : array | ||
$tax | string | array | What taxonom(y|ies) to pull from. Defaults to all registered taxonomies for the post type. You can use custom ones, or built-in WordPress taxonomies (category, tag). Timber plays nice and figures out that tag/tags/post_tag are all the same (and categories/category), for custom taxonomies you're on your own. |
$merge | boolean | Should the resulting array be one big one (true)? Or should it be an array of sub-arrays for each taxonomy (false)? |
리턴 | array |
public type ( ) : Timber\PostType | ||
리턴 | Timber\PostType |
public string $ID | ||
리턴 | string |
public string $ImageClass | ||
리턴 | string |
public string $PostClass | ||
리턴 | string |
public string $TermClass | ||
리턴 | string |
protected array $_next | ||
리턴 | array |
protected string $_permalink | ||
리턴 | string |
protected array $_prev | ||
리턴 | array |
public string $class | ||
리턴 | string |
public string $object_type | ||
리턴 | string |
public int $post_author | ||
리턴 | integer |
public string $post_content | ||
리턴 | string |
public string $post_date | ||
리턴 | string |
public string $post_excerpt | ||
리턴 | string |
public string $post_status | ||
리턴 | string |
public string $post_title | ||
리턴 | string |
public string $post_type | ||
리턴 | string |
public static string $representation | ||
리턴 | string |
public string $slug | ||
리턴 | string |