| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  * This is the object you use to access or extend WordPress posts. Think of it as Timber's (more accessible) version of WP_Post. This is used throughout Timber to represent posts retrieved from WordPress making them available to Twig templates. See the PHP and Twig examples for an example of what it's like to work with this object in your code. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  |  * @example | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  |  * ```php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  |  * <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  |  * // single.php, see connected twig example | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  |  * $context = Timber::get_context(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  |  * $context['post'] = new TimberPost(); // It's a new TimberPost object, but an existing post from WordPress. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  |  * Timber::render('single.twig', $context); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  |  * ?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  |  * ``` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  |  * ```twig | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  |  * {# single.twig #} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  |  * <article> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  |  *     <h1 class="headline">{{post.title}}</h1> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  |  *     <div class="body"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  |  *         {{post.content}} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  |  *     </div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  |  * </article> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  |  * ``` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  |  * ```html | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  |  * <article> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  |  *     <h1 class="headline">The Empire Strikes Back</h1> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  |  *     <div class="body"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  |  *         It is a dark time for the Rebellion. Although the Death Star has been destroyed, Imperial troops have driven the Rebel forces from their hidden base and pursued them across the galaxy. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  |  *     </div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  |  * </article> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |  * ``` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  |  * @package Timber | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  | class TimberPost extends TimberCore implements TimberCoreInterface { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  | 	 * @var string $ImageClass the name of the class to handle images by default | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  | 	public $ImageClass = 'TimberImage'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  | 	 * @var string $PostClass the name of the class to handle posts by default | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  | 	public $PostClass = 'TimberPost'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  | 	 * @var string $TermClass the name of the class to handle terms by default | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  | 	public $TermClass = 'TimberTerm'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  | 	 * @var string $object_type what does this class represent in WordPress terms? | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  | 	public $object_type = 'post'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  | 	 * @var string $representation what does this class represent in WordPress terms? | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  | 	public static $representation = 'post'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  | 	 * @internal | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  | 	 * @var string $_content stores the processed content internally | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  | 	protected $_content; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  | 	 * @internal | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 |  |  | 	 * @var array $_get_terms stores the results of a get_terms method call | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  | 	 * @deprecated | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 |  |  | 	protected $_get_terms; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 |  |  | 	 * @var string $_permalink the returned permalink from WP's get_permalink function | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 |  |  | 	protected $_permalink; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 80 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 81 |  |  | 	 * @var array $_next stores the results of the next TimberPost in a set inside an array (in order to manage by-taxonomy) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 82 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 83 |  |  | 	protected $_next = array(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 84 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 85 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 86 |  |  | 	 * @var array $_prev stores the results of the previous TimberPost in a set inside an array (in order to manage by-taxonomy) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 87 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 88 |  |  | 	protected $_prev = array(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 89 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 90 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 91 |  |  | 	 * @api | 
            
                                                                                                            
                            
            
                                    
            
            
                | 92 |  |  | 	 * @var string $class stores the CSS classes for the post (ex: "post post-type-book post-123") | 
            
                                                                                                            
                            
            
                                    
            
            
                | 93 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 94 |  |  | 	public $class; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 95 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 96 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 97 |  |  | 	 * @deprecated since 0.21.7 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 98 |  |  | 	 * @var string $display_date @deprecated stores the display date (ex: "October 6, 1984"), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 99 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 100 |  |  | 	public $display_date; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 101 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 102 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 103 |  |  | 	 * @api | 
            
                                                                                                            
                            
            
                                    
            
            
                | 104 |  |  | 	 * @var string $id the numeric WordPress id of a post | 
            
                                                                                                            
                            
            
                                    
            
            
                | 105 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 106 |  |  | 	public $id; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 107 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 108 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 109 |  |  | 	 * @var string 	$ID 			the numeric WordPress id of a post, capitalized to match WP usage | 
            
                                                                                                            
                            
            
                                    
            
            
                | 110 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 111 |  |  | 	public $ID; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 112 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 113 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 114 |  |  | 	 * @var int 	$post_author 	the numeric ID of the a post's author corresponding to the wp_user dtable | 
            
                                                                                                            
                            
            
                                    
            
            
                | 115 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 116 |  |  | 	public $post_author; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 117 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 118 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 119 |  |  | 	 * @var string 	$post_content 	the raw text of a WP post as stored in the database | 
            
                                                                                                            
                            
            
                                    
            
            
                | 120 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 121 |  |  | 	public $post_content; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 122 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 123 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 124 |  |  | 	 * @var string 	$post_date 		the raw date string as stored in the WP database, ex: 2014-07-05 18:01:39 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 125 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 126 |  |  | 	public $post_date; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 127 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 128 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 129 |  |  | 	 * @var string 	$post_exceprt 	the raw text of a manual post exceprt as stored in the database | 
            
                                                                                                            
                            
            
                                    
            
            
                | 130 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 131 |  |  | 	public $post_excerpt; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 132 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 133 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 134 |  |  | 	 * @var int 		$post_parent 	the numeric ID of a post's parent post | 
            
                                                                                                            
                            
            
                                    
            
            
                | 135 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 136 |  |  | 	public $post_parent; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 137 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 138 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 139 |  |  | 	 * @api | 
            
                                                                                                            
                            
            
                                    
            
            
                | 140 |  |  | 	 * @var string 		$post_status 	the status of a post ("draft", "publish", etc.) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 141 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 142 |  |  | 	public $post_status; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 143 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 144 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 145 |  |  | 	 * @var string 	$post_title 	the raw text of a post's title as stored in the database | 
            
                                                                                                            
                            
            
                                    
            
            
                | 146 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 147 |  |  | 	public $post_title; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 148 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 149 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 150 |  |  | 	 * @api | 
            
                                                                                                            
                            
            
                                    
            
            
                | 151 |  |  | 	 * @var string 	$post_type 		the name of the post type, this is the machine name (so "my_custom_post_type" as opposed to "My Custom Post Type") | 
            
                                                                                                            
                            
            
                                    
            
            
                | 152 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 153 |  |  | 	public $post_type; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 154 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 155 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 156 |  |  | 	 * @api | 
            
                                                                                                            
                            
            
                                    
            
            
                | 157 |  |  | 	 * @var string 	$slug 		the URL-safe slug, this corresponds to the poorly-named "post_name" in the WP database, ex: "hello-world" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 158 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 159 |  |  | 	public $slug; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 160 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 161 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 162 |  |  | 	 * If you send the constructor nothing it will try to figure out the current post id based on being inside The_Loop | 
            
                                                                                                            
                            
            
                                    
            
            
                | 163 |  |  | 	 * @example | 
            
                                                                                                            
                            
            
                                    
            
            
                | 164 |  |  | 	 * ```php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 165 |  |  | 	 * $post = new TimberPost(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 166 |  |  | 	 * $other_post = new TimberPost($random_post_id); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 167 |  |  | 	 * ``` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 168 |  |  | 	 * @param mixed $pid | 
            
                                                                                                            
                            
            
                                    
            
            
                | 169 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 170 |  |  | 	public function __construct($pid = null) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 171 |  |  | 		$pid = $this->determine_id( $pid ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 172 |  |  | 		$this->init($pid); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 173 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 174 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 175 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 176 |  |  | 	 * tries to figure out what post you want to get if not explictly defined (or if it is, allows it to be passed through) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 177 |  |  | 	 * @internal | 
            
                                                                                                            
                            
            
                                    
            
            
                | 178 |  |  | 	 * @param mixed a value to test against | 
            
                                                                                                            
                            
            
                                    
            
            
                | 179 |  |  | 	 * @return int the numberic id we should be using for this post object | 
            
                                                                                                            
                            
            
                                    
            
            
                | 180 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 181 |  |  | 	protected function determine_id($pid) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 182 |  |  | 		global $wp_query; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 183 |  |  | 		if ( $pid === null && | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 184 |  |  | 			isset($wp_query->queried_object_id) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 185 |  |  | 			&& $wp_query->queried_object_id | 
            
                                                                                                            
                            
            
                                    
            
            
                | 186 |  |  | 			&& isset($wp_query->queried_object) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 187 |  |  | 			&& is_object($wp_query->queried_object) | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 188 |  |  | 			&& get_class($wp_query->queried_object) == 'WP_Post' | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 189 |  |  | 			) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 190 |  |  | 			$pid = $wp_query->queried_object_id; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 191 |  |  | 		} else if ( $pid === null && $wp_query->is_home && isset($wp_query->queried_object_id) && $wp_query->queried_object_id )  { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 192 |  |  | 			//hack for static page as home page | 
            
                                                                                                            
                            
            
                                    
            
            
                | 193 |  |  | 			$pid = $wp_query->queried_object_id; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 194 |  |  | 		} else if ( $pid === null ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 195 |  |  | 			$gtid = false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 196 |  |  | 			$maybe_post = get_post(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 197 |  |  | 			if ( isset($maybe_post->ID) ){ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 198 |  |  | 				$gtid = true; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 199 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 200 |  |  | 			if ( $gtid ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 201 |  |  | 				$pid = get_the_ID(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 202 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 203 |  |  | 			if ( !$pid ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 204 |  |  | 				global $wp_query; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 205 |  |  | 				if ( isset($wp_query->query['p']) ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 206 |  |  | 					$pid = $wp_query->query['p']; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 207 |  |  | 				} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 208 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 209 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 210 |  |  | 		if ( $pid === null && ($pid_from_loop = TimberPostGetter::loop_to_id()) ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 211 |  |  | 			$pid = $pid_from_loop; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 212 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 213 |  |  | 		return $pid; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 214 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 215 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 216 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 217 |  |  | 	 * Outputs the title of the post if you do something like `<h1>{{post}}</h1>` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 218 |  |  | 	 * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 219 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 220 |  |  | 	public function __toString() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 221 |  |  | 		return $this->title(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 222 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 223 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 224 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 225 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 226 |  |  | 	 * Initializes a TimberPost | 
            
                                                                                                            
                            
            
                                    
            
            
                | 227 |  |  | 	 * @internal | 
            
                                                                                                            
                            
            
                                    
            
            
                | 228 |  |  | 	 * @param int|bool $pid | 
            
                                                                                                            
                            
            
                                    
            
            
                | 229 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 230 |  |  | 	protected function init($pid = false) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 231 |  |  | 		if ( $pid === false ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 232 |  |  | 			$pid = get_the_ID(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 233 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 234 |  |  | 		if ( is_numeric($pid) ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 235 |  |  | 			$this->ID = $pid; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 236 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 237 |  |  | 		$post_info = $this->get_info($pid); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 238 |  |  | 		$this->import($post_info); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 239 |  |  | 		/* deprecated, adding for support for older themes */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 240 |  |  | 		$this->display_date = $this->date(); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 241 |  |  | 		//cant have a function, so gots to do it this way | 
            
                                                                                                            
                            
            
                                    
            
            
                | 242 |  |  | 		$post_class = $this->post_class(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 243 |  |  | 		$this->class = $post_class; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 244 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 245 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 246 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 247 |  |  | 	 * Get the URL that will edit the current post/object | 
            
                                                                                                            
                            
            
                                    
            
            
                | 248 |  |  | 	 * @internal | 
            
                                                                                                            
                            
            
                                    
            
            
                | 249 |  |  | 	 * @see TimberPost::edit_link | 
            
                                                                                                            
                            
            
                                    
            
            
                | 250 |  |  | 	 * @return bool|string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 251 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 252 |  |  | 	function get_edit_url() { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 253 |  |  | 		if ( $this->can_edit() ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 254 |  |  | 			return get_edit_post_link($this->ID); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 255 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 256 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 257 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 258 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 259 |  |  | 	 * updates the post_meta of the current object with the given value | 
            
                                                                                                            
                            
            
                                    
            
            
                | 260 |  |  | 	 * @param string $field | 
            
                                                                                                            
                            
            
                                    
            
            
                | 261 |  |  | 	 * @param mixed $value | 
            
                                                                                                            
                            
            
                                    
            
            
                | 262 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 263 |  |  | 	public function update( $field, $value ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 264 |  |  | 		if ( isset($this->ID) ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 265 |  |  | 			update_post_meta($this->ID, $field, $value); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 266 |  |  | 			$this->$field = $value; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 267 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 268 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 269 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 270 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 271 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 272 |  |  | 	 * takes a mix of integer (post ID), string (post slug), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 273 |  |  | 	 * or object to return a WordPress post object from WP's built-in get_post() function | 
            
                                                                                                            
                            
            
                                    
            
            
                | 274 |  |  | 	 * @internal | 
            
                                                                                                            
                            
            
                                    
            
            
                | 275 |  |  | 	 * @param mixed $pid | 
            
                                                                                                            
                            
            
                                    
            
            
                | 276 |  |  | 	 * @return WP_Post on success | 
            
                                                                                                            
                            
            
                                    
            
            
                | 277 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 278 |  |  | 	protected function prepare_post_info( $pid = 0 ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 279 |  |  | 		if ( is_string($pid) || is_numeric($pid) || (is_object($pid) && !isset($pid->post_title)) || $pid === 0 ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                            
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 280 |  |  | 			$pid = self::check_post_id($pid); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 281 |  |  | 			$post = get_post($pid); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 282 |  |  | 			if ( $post ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 283 |  |  | 				return $post; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 284 |  |  | 			} else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 285 |  |  | 				$post = get_page($pid); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 286 |  |  | 				return $post; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 287 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 288 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 289 |  |  | 		//we can skip if already is WP_Post | 
            
                                                                                                            
                            
            
                                    
            
            
                | 290 |  |  | 		return $pid; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 291 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 292 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 293 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 294 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 295 |  |  | 	 * helps you find the post id regardless of whether you send a string or whatever | 
            
                                                                                                            
                            
            
                                    
            
            
                | 296 |  |  | 	 * @param integer $pid ; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 297 |  |  | 	 * @internal | 
            
                                                                                                            
                            
            
                                    
            
            
                | 298 |  |  | 	 * @return integer ID number of a post | 
            
                                                                                                            
                            
            
                                    
            
            
                | 299 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 300 |  |  | 	protected function check_post_id( $pid ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 301 |  |  | 		if ( is_numeric($pid) && $pid === 0 ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 302 |  |  | 			$pid = get_the_ID(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 303 |  |  | 			return $pid; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 304 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 305 |  |  | 		if ( !is_numeric($pid) && is_string($pid) ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 306 |  |  | 			$pid = self::get_post_id_by_name($pid); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 307 |  |  | 			return $pid; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 308 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 309 |  |  | 		if ( !$pid ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 310 |  |  | 			return null; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 311 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 312 |  |  | 		return $pid; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 313 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 314 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 315 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 316 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 317 |  |  | 	 * get_post_id_by_name($post_name) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 318 |  |  | 	 * @internal | 
            
                                                                                                            
                            
            
                                    
            
            
                | 319 |  |  | 	 * @param string $post_name | 
            
                                                                                                            
                            
            
                                    
            
            
                | 320 |  |  | 	 * @return int | 
            
                                                                                                            
                            
            
                                    
            
            
                | 321 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 322 |  |  | 	static function get_post_id_by_name($post_name) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 323 |  |  | 		global $wpdb; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 324 |  |  | 		$query = $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_name = %s LIMIT 1", $post_name); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 325 |  |  | 		$result = $wpdb->get_row($query); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                            
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 326 |  |  | 		if (!$result) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                            
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 327 |  |  | 			return null; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 328 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 329 |  |  | 		return $result->ID; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 330 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 331 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 332 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 333 |  |  | 	 * get a preview of your post, if you have an excerpt it will use that, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 334 |  |  | 	 * otherwise it will pull from the post_content. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 335 |  |  | 	 * If there's a <!-- more --> tag it will use that to mark where to pull through. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 336 |  |  | 	 * @api | 
            
                                                                                                            
                            
            
                                    
            
            
                | 337 |  |  | 	 * @example | 
            
                                                                                                            
                            
            
                                    
            
            
                | 338 |  |  | 	 * ```twig | 
            
                                                                                                            
                            
            
                                    
            
            
                | 339 |  |  | 	 * <p>{{post.get_preview(50)}}</p> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 340 |  |  | 	 * ``` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 341 |  |  | 	 * @param int $len 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 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 342 |  |  | 	 * @param bool $force 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 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 343 |  |  | 	 * @param string $readmore The text you want to use on the 'readmore' link | 
            
                                                                                                            
                            
            
                                    
            
            
                | 344 |  |  | 	 * @param bool $strip Strip tags? yes or no. tell me! | 
            
                                                                                                            
                            
            
                                    
            
            
                | 345 |  |  | 	 * @return string of the post preview | 
            
                                                                                                            
                            
            
                                    
            
            
                | 346 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 347 |  |  | 	function get_preview($len = 50, $force = false, $readmore = 'Read More', $strip = true) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 348 |  |  | 		$text = ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 349 |  |  | 		$trimmed = false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 350 |  |  | 		if ( isset($this->post_excerpt) && strlen($this->post_excerpt) ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 351 |  |  | 			if ( $force ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 352 |  |  | 				$text = TimberHelper::trim_words($this->post_excerpt, $len, false); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 353 |  |  | 				$trimmed = true; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 354 |  |  | 			} else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 355 |  |  | 				$text = $this->post_excerpt; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 356 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 357 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 358 |  |  | 		if ( !strlen($text) && preg_match('/<!--\s?more(.*?)?-->/', $this->post_content, $readmore_matches) ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 359 |  |  | 			$pieces = explode($readmore_matches[0], $this->post_content); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 360 |  |  | 			$text = $pieces[0]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 361 |  |  | 			if ( $force ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 362 |  |  | 				$text = TimberHelper::trim_words($text, $len, false); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 363 |  |  | 				$trimmed = true; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 364 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 365 |  |  | 			$text = do_shortcode( $text ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 366 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 367 |  |  | 		if ( !strlen($text) ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 368 |  |  | 			$text = TimberHelper::trim_words($this->get_content(), $len, false); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 369 |  |  | 			$trimmed = true; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 370 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 371 |  |  | 		if ( !strlen(trim($text)) ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 372 |  |  | 			return trim($text); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 373 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 374 |  |  | 		if ( $strip ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 375 |  |  | 			$text = trim(strip_tags($text)); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 376 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 377 |  |  | 		if ( strlen($text) ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 378 |  |  | 			$text = trim($text); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 379 |  |  | 			$last = $text[strlen($text) - 1]; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 380 |  |  | 			if ( $last != '.' && $trimmed ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 381 |  |  | 				$text .= ' … '; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 382 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 383 |  |  | 			if ( !$strip ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 384 |  |  | 				$last_p_tag = strrpos($text, '</p>'); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 385 |  |  | 				if ( $last_p_tag !== false ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 386 |  |  | 					$text = substr($text, 0, $last_p_tag); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 387 |  |  | 				} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 388 |  |  | 				if ( $last != '.' && $trimmed ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 389 |  |  | 					$text .= ' … '; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 390 |  |  | 				} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 391 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 392 |  |  | 			if ( $readmore && isset($readmore_matches) && !empty($readmore_matches[1]) ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 393 |  |  | 				$text .= ' <a href="' . $this->get_permalink() . '" class="read-more">' . trim($readmore_matches[1]) . '</a>'; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 394 |  |  | 			} elseif ( $readmore ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 395 |  |  | 				$text .= ' <a href="' . $this->get_permalink() . '" class="read-more">' . trim($readmore) . '</a>'; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 396 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 397 |  |  | 			if ( !$strip && $last_p_tag && ( strpos($text, '<p>') || strpos($text, '<p ') ) ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                            
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 398 |  |  | 				$text .= '</p>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 399 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 400 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 401 |  |  | 		return trim($text); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 402 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 403 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 404 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 405 |  |  | 	 * gets the post custom and attaches it to the current object | 
            
                                                                                                            
                            
            
                                    
            
            
                | 406 |  |  | 	 * @internal | 
            
                                                                                                            
                            
            
                                    
            
            
                | 407 |  |  | 	 * @param bool|int $pid a post ID number | 
            
                                                                                                            
                            
            
                                    
            
            
                | 408 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 409 |  |  | 	function import_custom( $pid = false ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 410 |  |  | 		if ( !$pid ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 411 |  |  | 			$pid = $this->ID; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 412 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 413 |  |  | 		$customs = $this->get_post_custom($pid); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 414 |  |  | 		$this->import($customs); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 415 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 416 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 417 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 418 |  |  | 	 * Used internally to fetch the metadata fields (wp_postmeta table) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 419 |  |  | 	 * and attach them to our TimberPost object | 
            
                                                                                                            
                            
            
                                    
            
            
                | 420 |  |  | 	 * @internal | 
            
                                                                                                            
                            
            
                                    
            
            
                | 421 |  |  | 	 * @param int $pid | 
            
                                                                                                            
                            
            
                                    
            
            
                | 422 |  |  | 	 * @return array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 423 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 424 |  |  | 	protected function get_post_custom( $pid ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 425 |  |  | 		apply_filters('timber_post_get_meta_pre', array(), $pid, $this); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 426 |  |  | 		$customs = get_post_custom($pid); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 427 |  |  | 		if ( !is_array($customs) || empty($customs) ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 428 |  |  | 			return array(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 429 |  |  | 		} | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 430 |  | View Code Duplication | 		foreach ( $customs as $key => $value ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 431 |  |  | 			if ( is_array($value) && count($value) == 1 && isset($value[0]) ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 432 |  |  | 				$value = $value[0]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 433 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 434 |  |  | 			$customs[$key] = maybe_unserialize($value); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 435 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 436 |  |  | 		$customs = apply_filters('timber_post_get_meta', $customs, $pid, $this); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 437 |  |  | 		return $customs; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 438 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 439 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 440 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 441 |  |  | 	 * @internal | 
            
                                                                                                            
                            
            
                                    
            
            
                | 442 |  |  | 	 * @see TimberPost::thumbnail | 
            
                                                                                                            
                            
            
                                    
            
            
                | 443 |  |  | 	 * @return null|TimberImage | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 444 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 445 |  |  | 	function get_thumbnail() { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 446 |  |  | 		if ( function_exists('get_post_thumbnail_id') ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 447 |  |  | 			$tid = get_post_thumbnail_id($this->ID); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 448 |  |  | 			if ( $tid ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 449 |  |  | 				return new $this->ImageClass($tid); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 450 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 451 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 452 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 453 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 454 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 455 |  |  | 	 * @internal | 
            
                                                                                                            
                            
            
                                    
            
            
                | 456 |  |  | 	 * @see TimberPost::link | 
            
                                                                                                            
                            
            
                                    
            
            
                | 457 |  |  | 	 * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 458 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 459 |  |  | 	function get_permalink() { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 460 |  |  | 		if ( isset($this->_permalink) ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 461 |  |  | 			return $this->_permalink; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 462 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 463 |  |  | 		$this->_permalink = get_permalink($this->ID); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 464 |  |  | 		return $this->_permalink; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 465 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 466 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 467 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 468 |  |  | 	 * get the permalink for a post object | 
            
                                                                                                            
                            
            
                                    
            
            
                | 469 |  |  | 	 * In your templates you should use link: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 470 |  |  | 	 * <a href="{{post.link}}">Read my post</a> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 471 |  |  | 	 * @internal | 
            
                                                                                                            
                            
            
                                    
            
            
                | 472 |  |  | 	 * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 473 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 474 |  |  | 	function get_link() { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 475 |  |  | 		return $this->get_permalink(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 476 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 477 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 478 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 479 |  |  | 	 * Get the next post in WordPress's ordering | 
            
                                                                                                            
                            
            
                                    
            
            
                | 480 |  |  | 	 * @internal | 
            
                                                                                                            
                            
            
                                    
            
            
                | 481 |  |  | 	 * @param bool $taxonomy | 
            
                                                                                                            
                            
            
                                    
            
            
                | 482 |  |  | 	 * @return TimberPost|boolean | 
            
                                                                                                            
                            
            
                                    
            
            
                | 483 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 484 |  |  | 	function get_next( $taxonomy = false ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 485 |  |  | 		if ( !isset($this->_next) || !isset($this->_next[$taxonomy]) ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 486 |  |  | 			global $post; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 487 |  |  | 			$this->_next = array(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 488 |  |  | 			$old_global = $post; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 489 |  |  | 			$post = $this; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 490 |  |  | 			if ( $taxonomy ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 491 |  |  | 				$adjacent = get_adjacent_post(true, '', false, $taxonomy); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 492 |  |  | 			} else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 493 |  |  | 				$adjacent = get_adjacent_post(false, '', false); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 494 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 495 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 496 |  |  | 			if ( $adjacent ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 497 |  |  | 				$this->_next[$taxonomy] = new $this->PostClass($adjacent); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 498 |  |  | 			} else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 499 |  |  | 				$this->_next[$taxonomy] = false; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 500 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 501 |  |  | 			$post = $old_global; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 502 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 503 |  |  | 		return $this->_next[$taxonomy]; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 504 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 505 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 506 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 507 |  |  | 	 * Get a data array of pagination so you can navigate to the previous/next for a paginated post | 
            
                                                                                                            
                            
            
                                    
            
            
                | 508 |  |  | 	 * @return array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 509 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 510 |  |  | 	public function get_pagination() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 511 |  |  | 		global $post, $page, $numpages, $multipage; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 512 |  |  | 		$post = $this; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 513 |  |  | 		$ret = array(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 514 |  |  | 		if ( $multipage ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 515 |  |  | 			for ( $i = 1; $i <= $numpages; $i++ ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 516 |  |  | 				$link = self::get_wp_link_page($i); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 517 |  |  | 				$data = array('name' => $i, 'title' => $i, 'text' => $i, 'link' => $link); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 518 |  |  | 				if ( $i == $page ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 519 |  |  | 					$data['current'] = true; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 520 |  |  | 				} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 521 |  |  | 				$ret['pages'][] = $data; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 522 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 523 |  |  | 			$i = $page - 1; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 524 |  |  | 			if ( $i ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 525 |  |  | 				$link = self::get_wp_link_page($i); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 526 |  |  | 				$ret['prev'] = array('link' => $link); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 527 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 528 |  |  | 			$i = $page + 1; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 529 |  |  | 			if ( $i <= $numpages ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 530 |  |  | 				$link = self::get_wp_link_page($i); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 531 |  |  | 				$ret['next'] = array('link' => $link); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 532 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 533 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 534 |  |  | 		return $ret; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 535 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 536 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 537 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 538 |  |  | 	 * @param int $i | 
            
                                                                                                            
                            
            
                                    
            
            
                | 539 |  |  | 	 * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 540 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 541 |  |  | 	protected static function get_wp_link_page($i) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 542 |  |  | 		$link = _wp_link_page($i); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 543 |  |  | 		$link = new SimpleXMLElement($link . '</a>'); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 544 |  |  | 		if ( isset($link['href']) ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 545 |  |  | 			return $link['href']; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 546 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 547 |  |  | 		return ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 548 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 549 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 550 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 551 |  |  | 	 * Get the permalink for a post, but as a relative path | 
            
                                                                                                            
                            
            
                                    
            
            
                | 552 |  |  | 	 * For example, where {{post.link}} would return "http://example.org/2015/07/04/my-cool-post" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 553 |  |  | 	 * this will return the relative version: "/2015/07/04/my-cool-post" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 554 |  |  | 	 * @internal | 
            
                                                                                                            
                            
            
                                    
            
            
                | 555 |  |  | 	 * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 556 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 557 |  |  | 	function get_path() { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 558 |  |  | 		return TimberURLHelper::get_rel_url($this->get_link()); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 559 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 560 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 561 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 562 |  |  | 	 * Get the next post in WordPress's ordering | 
            
                                                                                                            
                            
            
                                    
            
            
                | 563 |  |  | 	 * @internal | 
            
                                                                                                            
                            
            
                                    
            
            
                | 564 |  |  | 	 * @param bool $taxonomy | 
            
                                                                                                            
                            
            
                                    
            
            
                | 565 |  |  | 	 * @return TimberPost|boolean | 
            
                                                                                                            
                            
            
                                    
            
            
                | 566 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 567 |  |  | 	function get_prev( $taxonomy = false ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 568 |  |  | 		if ( isset($this->_prev) && isset($this->_prev[$taxonomy]) ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 569 |  |  | 			return $this->_prev[$taxonomy]; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 570 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 571 |  |  | 		global $post; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 572 |  |  | 		$old_global = $post; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 573 |  |  | 		$post = $this; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 574 |  |  | 		$within_taxonomy = ($taxonomy) ? $taxonomy : 'category'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 575 |  |  | 		$adjacent = get_adjacent_post(($taxonomy), '', true, $within_taxonomy); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 576 |  |  | 		$prev_in_taxonomy = false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 577 |  |  | 		if ( $adjacent ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 578 |  |  | 			$prev_in_taxonomy = new $this->PostClass($adjacent); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 579 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 580 |  |  | 		$this->_prev[$taxonomy] = $prev_in_taxonomy; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 581 |  |  | 		$post = $old_global; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 582 |  |  | 		return $this->_prev[$taxonomy]; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 583 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 584 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 585 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 586 |  |  | 	 * Get the parent post of the post | 
            
                                                                                                            
                            
            
                                    
            
            
                | 587 |  |  | 	 * @internal | 
            
                                                                                                            
                            
            
                                    
            
            
                | 588 |  |  | 	 * @return bool|TimberPost | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 589 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 590 |  |  | 	function get_parent() { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 591 |  |  | 		if ( !$this->post_parent ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 592 |  |  | 			return false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 593 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 594 |  |  | 		return new $this->PostClass($this->post_parent); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 595 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 596 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 597 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 598 |  |  | 	 * Gets a User object from the author of the post | 
            
                                                                                                            
                            
            
                                    
            
            
                | 599 |  |  | 	 * @internal | 
            
                                                                                                            
                            
            
                                    
            
            
                | 600 |  |  | 	 * @see TimberPost::author | 
            
                                                                                                            
                            
            
                                    
            
            
                | 601 |  |  | 	 * @return bool|TimberUser | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 602 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 603 |  |  | 	function get_author() { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 604 |  |  | 		if ( isset($this->post_author) ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 605 |  |  | 			return new TimberUser($this->post_author); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 606 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 607 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 608 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 609 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 610 |  |  | 	 * @internal | 
            
                                                                                                            
                            
            
                                    
            
            
                | 611 |  |  | 	 * @return bool|TimberUser | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 612 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 613 |  |  | 	function get_modified_author() { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 614 |  |  | 		$user_id = get_post_meta($this->ID, '_edit_last', true); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 615 |  |  | 		return ($user_id ? new TimberUser($user_id) : $this->get_author()); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 616 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 617 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 618 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 619 |  |  | 	 * Used internally by init, etc. to build TimberPost object | 
            
                                                                                                            
                            
            
                                    
            
            
                | 620 |  |  | 	 * @internal | 
            
                                                                                                            
                            
            
                                    
            
            
                | 621 |  |  | 	 * @param  int $pid | 
            
                                                                                                            
                            
            
                                    
            
            
                | 622 |  |  | 	 * @return null|object|WP_Post | 
            
                                                                                                            
                            
            
                                    
            
            
                | 623 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 624 |  |  | 	protected function get_info($pid) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 625 |  |  | 		$post = $this->prepare_post_info($pid); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 626 |  |  | 		if ( !isset($post->post_status) ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 627 |  |  | 			return null; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 628 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 629 |  |  | 		$post->status = $post->post_status; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 630 |  |  | 		$post->id = $post->ID; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 631 |  |  | 		$post->slug = $post->post_name; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 632 |  |  | 		$customs = $this->get_post_custom($post->ID); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 633 |  |  | 		$post->custom = $customs; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 634 |  |  | 		$post = (object) array_merge((array)$customs, (array)$post); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                            
                                                                                            
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 635 |  |  | 		return $post; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 636 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 637 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 638 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 639 |  |  | 	 * Get the human-friendly date that should actually display in a .twig template | 
            
                                                                                                            
                            
            
                                    
            
            
                | 640 |  |  | 	 * @deprecated since 0.20.0 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 641 |  |  | 	 * @see TimberPost::date | 
            
                                                                                                            
                            
            
                                    
            
            
                | 642 |  |  | 	 * @param string $use | 
            
                                                                                                            
                            
            
                                    
            
            
                | 643 |  |  | 	 * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 644 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 645 |  |  | 	function get_display_date( $use = 'post_date' ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 646 |  |  | 		return date(get_option('date_format'), strtotime($this->$use)); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 647 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 648 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 649 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 650 |  |  | 	 * @internal | 
            
                                                                                                            
                            
            
                                    
            
            
                | 651 |  |  | 	 * @see TimberPost::date | 
            
                                                                                                            
                            
            
                                    
            
            
                | 652 |  |  | 	 * @param  string $date_format | 
            
                                                                                                            
                            
            
                                    
            
            
                | 653 |  |  | 	 * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 654 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 655 |  |  | 	function get_date( $date_format = '' ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 656 |  |  | 		$df = $date_format ? $date_format : get_option('date_format'); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 657 |  |  | 		$the_date = (string)mysql2date($df, $this->post_date); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 658 |  |  | 		return apply_filters('get_the_date', $the_date, $df); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 659 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 660 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 661 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 662 |  |  | 	 * @internal | 
            
                                                                                                            
                            
            
                                    
            
            
                | 663 |  |  | 	 * @param  string $date_format | 
            
                                                                                                            
                            
            
                                    
            
            
                | 664 |  |  | 	 * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 665 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 666 |  |  | 	function get_modified_date( $date_format = '' ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 667 |  |  | 		$df = $date_format ? $date_format : get_option('date_format'); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 668 |  |  | 		$the_time = $this->get_modified_time($df); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 669 |  |  | 		return apply_filters('get_the_modified_date', $the_time, $date_format); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 670 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 671 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 672 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 673 |  |  | 	 * @internal | 
            
                                                                                                            
                            
            
                                    
            
            
                | 674 |  |  | 	 * @param  string $time_format | 
            
                                                                                                            
                            
            
                                    
            
            
                | 675 |  |  | 	 * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 676 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 677 |  |  | 	function get_modified_time( $time_format = '' ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 678 |  |  | 		$tf = $time_format ? $time_format : get_option('time_format'); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 679 |  |  | 		$the_time = get_post_modified_time($tf, false, $this->ID, true); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 680 |  |  | 		return apply_filters('get_the_modified_time', $the_time, $time_format); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 681 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 682 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 683 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 684 |  |  | 	 * @internal | 
            
                                                                                                            
                            
            
                                    
            
            
                | 685 |  |  | 	 * @see TimberPost::children | 
            
                                                                                                            
                            
            
                                    
            
            
                | 686 |  |  | 	 * @param string 		$post_type | 
            
                                                                                                            
                            
            
                                    
            
            
                | 687 |  |  | 	 * @param bool|string 	$childPostClass | 
            
                                                                                                            
                            
            
                                    
            
            
                | 688 |  |  | 	 * @return array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 689 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 690 |  |  | 	function get_children( $post_type = 'any', $childPostClass = false ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 691 |  |  | 		if ( $childPostClass === false ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 692 |  |  | 			$childPostClass = $this->PostClass; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 693 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 694 |  |  | 		if ( $post_type == 'parent' ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 695 |  |  | 			$post_type = $this->post_type; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 696 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 697 |  |  | 		$children = get_children('post_parent=' . $this->ID . '&post_type=' . $post_type . '&numberposts=-1&orderby=menu_order title&order=ASC'); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 698 |  |  | 		foreach ( $children as &$child ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 699 |  |  | 			$child = new $childPostClass($child->ID); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 700 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 701 |  |  | 		$children = array_values($children); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 702 |  |  | 		return $children; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 703 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 704 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 705 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 706 |  |  | 	 * Get the comments for a post | 
            
                                                                                                            
                            
            
                                    
            
            
                | 707 |  |  | 	 * @internal | 
            
                                                                                                            
                            
            
                                    
            
            
                | 708 |  |  | 	 * @see TimberPost::comments | 
            
                                                                                                            
                            
            
                                    
            
            
                | 709 |  |  | 	 * @param int $ct | 
            
                                                                                                            
                            
            
                                    
            
            
                | 710 |  |  | 	 * @param string $order | 
            
                                                                                                            
                            
            
                                    
            
            
                | 711 |  |  | 	 * @param string $type | 
            
                                                                                                            
                            
            
                                    
            
            
                | 712 |  |  | 	 * @param string $status | 
            
                                                                                                            
                            
            
                                    
            
            
                | 713 |  |  | 	 * @param string $CommentClass | 
            
                                                                                                            
                            
            
                                    
            
            
                | 714 |  |  | 	 * @return array|mixed | 
            
                                                                                                            
                            
            
                                    
            
            
                | 715 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 716 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 717 |  |  | 	function get_comments($ct = 0, $order = 'wp', $type = 'comment', $status = 'approve', $CommentClass = 'TimberComment') { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 718 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 719 |  |  | 		global $overridden_cpage; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 720 |  |  | 		$overridden_cpage = false; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 721 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 722 |  |  | 		$args = array('post_id' => $this->ID, 'status' => $status, 'order' => $order); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 723 |  |  | 		if ( $ct > 0 ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 724 |  |  | 			$args['number'] = $ct; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 725 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 726 |  |  | 		if ( strtolower($order) == 'wp' || strtolower($order) == 'wordpress' ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 727 |  |  | 			$args['order'] = get_option('comment_order'); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 728 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 729 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 730 |  |  | 		$comments = get_comments($args); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 731 |  |  | 		$timber_comments = array(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 732 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 733 |  |  | 		if ( '' == get_query_var('cpage') && get_option('page_comments') ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 734 |  |  | 			set_query_var( 'cpage', 'newest' == get_option('default_comments_page') ? get_comment_pages_count() : 1 ); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 735 |  |  | 			$overridden_cpage = true; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 736 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 737 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 738 |  |  |         foreach( $comments as $key => &$comment ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 739 |  |  |             $timber_comment = new $CommentClass($comment); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 740 |  |  |             $timber_comments[$timber_comment->id] = $timber_comment; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 741 |  |  |         } | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 742 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 743 |  |  | 		foreach( $timber_comments as $key => $comment ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 744 |  |  | 			if ( $comment->is_child() ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 745 |  |  | 				unset($timber_comments[$comment->id]); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 746 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 747 |  |  | 				if ( isset($timber_comments[$comment->comment_parent]) ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 748 |  |  | 					$timber_comments[$comment->comment_parent]->children[] = $comment; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 749 |  |  | 				} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 750 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 751 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 752 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 753 |  |  | 		$timber_comments = array_values($timber_comments); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 754 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 755 |  |  | 		return $timber_comments; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 756 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 757 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 758 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 759 |  |  | 	 * Get the categories for a post | 
            
                                                                                                            
                            
            
                                    
            
            
                | 760 |  |  | 	 * @internal | 
            
                                                                                                            
                            
            
                                    
            
            
                | 761 |  |  | 	 * @see TimberPost::categories | 
            
                                                                                                            
                            
            
                                    
            
            
                | 762 |  |  | 	 * @return array of TimberTerms | 
            
                                                                                                            
                            
            
                                    
            
            
                | 763 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 764 |  |  | 	function get_categories() { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 765 |  |  | 		return $this->get_terms('category'); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 766 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 767 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 768 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 769 |  |  | 	 * @internal | 
            
                                                                                                            
                            
            
                                    
            
            
                | 770 |  |  | 	 * @see TimberPost::category | 
            
                                                                                                            
                            
            
                                    
            
            
                | 771 |  |  | 	 * @return mixed | 
            
                                                                                                            
                            
            
                                    
            
            
                | 772 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 773 |  |  | 	function get_category( ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 774 |  |  | 		$cats = $this->get_categories(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 775 |  |  | 		if ( count($cats) && isset($cats[0]) ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 776 |  |  | 			return $cats[0]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 777 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 778 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 779 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 780 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 781 |  |  | 	 * @internal | 
            
                                                                                                            
                            
            
                                    
            
            
                | 782 |  |  | 	 * @param string|array $tax | 
            
                                                                                                            
                            
            
                                    
            
            
                | 783 |  |  | 	 * @param bool $merge | 
            
                                                                                                            
                            
            
                                    
            
            
                | 784 |  |  | 	 * @param string $TermClass | 
            
                                                                                                            
                            
            
                                    
            
            
                | 785 |  |  | 	 * @return array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 786 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 787 |  |  | 	function get_terms( $tax = '', $merge = true, $TermClass = '' ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 788 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 789 |  |  | 		$TermClass = $TermClass ?: $this->TermClass; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 790 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 791 |  |  | 		if ( is_string($merge) && class_exists($merge) ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 792 |  |  | 			$TermClass = $merge; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 793 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 794 |  |  | 		if ( is_array($tax) ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 795 |  |  | 			$taxonomies = $tax; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 796 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 797 |  |  | 		if ( is_string($tax) ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 798 |  |  | 			if ( in_array($tax, array('all','any','')) ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                            
                                                                                            
                                                                                            
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 799 |  |  | 				$taxonomies = get_object_taxonomies($this->post_type); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 800 |  |  | 			} else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 801 |  |  | 				$taxonomies = array($tax); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 802 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 803 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 804 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 805 |  |  | 		$term_class_objects = array(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 806 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 807 |  |  | 		foreach ( $taxonomies as $taxonomy ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 808 |  |  | 			if ( in_array($taxonomy, array('tag','tags')) ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                            
                                                                                            
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 809 |  |  | 				$taxonomy = 'post_tag'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 810 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 811 |  |  | 			if ( $taxonomy == 'categories' ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 812 |  |  | 				$taxonomy = 'category'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 813 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 814 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 815 |  |  | 			$terms = wp_get_post_terms($this->ID, $taxonomy); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 816 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 817 |  |  | 			if ( is_wp_error($terms) ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 818 |  |  | 				/* @var $terms WP_Error */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 819 |  |  | 				TimberHelper::error_log("Error retrieving terms for taxonomy '$taxonomy' on a post in timber-post.php"); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 820 |  |  | 				TimberHelper::error_log('tax = ' . print_r($tax, true)); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 821 |  |  | 				TimberHelper::error_log('WP_Error: ' . $terms->get_error_message()); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 822 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 823 |  |  | 				return $term_class_objects; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 824 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 825 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 826 |  |  | 			// map over array of wordpress terms, and transform them into instances of the TermClass | 
            
                                                                                                            
                            
            
                                    
            
            
                | 827 |  |  | 			$terms = array_map(function($term) use ($TermClass, $taxonomy) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 828 |  |  | 				return call_user_func(array($TermClass, 'from'), $term->term_id, $taxonomy); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                            
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 829 |  |  | 			}, $terms); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 830 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 831 |  |  | 			if ( $merge && is_array($terms) ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 832 |  |  | 				$term_class_objects = array_merge($term_class_objects, $terms); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 833 |  |  | 			} else if ( count($terms) ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 834 |  |  | 				$term_class_objects[$taxonomy] = $terms; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 835 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 836 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 837 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 838 |  |  | 		return $term_class_objects; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 839 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 840 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 841 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 842 |  |  | 	 * @param string|int $term_name_or_id | 
            
                                                                                                            
                            
            
                                    
            
            
                | 843 |  |  | 	 * @param string $taxonomy | 
            
                                                                                                            
                            
            
                                    
            
            
                | 844 |  |  | 	 * @return bool | 
            
                                                                                                            
                            
            
                                    
            
            
                | 845 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 846 |  |  | 	function has_term( $term_name_or_id, $taxonomy = 'all' ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 847 |  |  | 		if ( $taxonomy == 'all' || $taxonomy == 'any' ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 848 |  |  | 			$taxes = get_object_taxonomies($this->post_type, 'names'); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 849 |  |  | 			$ret = false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 850 |  |  | 			foreach ( $taxes as $tax ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 851 |  |  | 				if ( has_term($term_name_or_id, $tax, $this->ID) ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 852 |  |  | 					$ret = true; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 853 |  |  | 					break; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 854 |  |  | 				} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 855 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 856 |  |  | 			return $ret; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 857 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 858 |  |  | 		return has_term($term_name_or_id, $taxonomy, $this->ID); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 859 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 860 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 861 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 862 |  |  | 	 * @param string $field | 
            
                                                                                                            
                            
            
                                    
            
            
                | 863 |  |  | 	 * @return TimberImage | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 864 |  |  | 	 */ | 
            
                                                                        
                            
            
                                    
            
            
                | 865 |  |  | 	function get_image( $field ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                        
                            
            
                                    
            
            
                | 866 |  |  | 		return new $this->ImageClass($this->$field); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                        
                            
            
                                    
            
            
                | 867 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 868 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 869 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 870 |  |  | 	 * Gets an array of tags for you to use | 
            
                                                                                                            
                            
            
                                    
            
            
                | 871 |  |  | 	 * @internal | 
            
                                                                                                            
                            
            
                                    
            
            
                | 872 |  |  | 	 * @example | 
            
                                                                                                            
                            
            
                                    
            
            
                | 873 |  |  | 	 * ```twig | 
            
                                                                                                            
                            
            
                                    
            
            
                | 874 |  |  | 	 * <ul class="tags"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 875 |  |  | 	 *     {% for tag in post.tags %} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 876 |  |  | 	 *         <li>{{tag.name}}</li> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 877 |  |  | 	 *     {% endfor %} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 878 |  |  | 	 * </ul> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 879 |  |  | 	 * ``` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 880 |  |  | 	 * @return array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 881 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 882 |  |  | 	function get_tags() { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 883 |  |  | 		return $this->get_terms('post_tag'); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 884 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 885 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 886 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 887 |  |  | 	 * Outputs the title with filters applied | 
            
                                                                                                            
                            
            
                                    
            
            
                | 888 |  |  | 	 * @internal | 
            
                                                                                                            
                            
            
                                    
            
            
                | 889 |  |  | 	 * @example | 
            
                                                                                                            
                            
            
                                    
            
            
                | 890 |  |  | 	 * ```twig | 
            
                                                                                                            
                            
            
                                    
            
            
                | 891 |  |  | 	 * <h1>{{post.get_title}}</h1> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 892 |  |  | 	 * ``` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 893 |  |  | 	 * ```html | 
            
                                                                                                            
                            
            
                                    
            
            
                | 894 |  |  | 	 * <h1>Hello World!</h1> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 895 |  |  | 	 * ``` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 896 |  |  | 	 * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 897 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 898 |  |  | 	function get_title() { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 899 |  |  | 		return apply_filters('the_title', $this->post_title, $this->ID); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 900 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 901 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 902 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 903 |  |  | 	 * Displays the content of the post with filters, shortcodes and wpautop applied | 
            
                                                                                                            
                            
            
                                    
            
            
                | 904 |  |  | 	 * @example | 
            
                                                                                                            
                            
            
                                    
            
            
                | 905 |  |  | 	 * ```twig | 
            
                                                                                                            
                            
            
                                    
            
            
                | 906 |  |  | 	 * <div class="article-text">{{post.get_content}}</div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 907 |  |  | 	 * ``` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 908 |  |  | 	 * ```html | 
            
                                                                                                            
                            
            
                                    
            
            
                | 909 |  |  | 	 * <div class="article-text"><p>Blah blah blah</p><p>More blah blah blah.</p></div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 910 |  |  | 	 * ``` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 911 |  |  | 	 * @param int $len | 
            
                                                                                                            
                            
            
                                    
            
            
                | 912 |  |  | 	 * @param int $page | 
            
                                                                                                            
                            
            
                                    
            
            
                | 913 |  |  | 	 * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 914 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 915 |  |  | 	function get_content( $len = 0, $page = 0 ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 916 |  |  | 		if ( $len == 0 && $page == 0 && $this->_content ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 917 |  |  | 			return $this->_content; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 918 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 919 |  |  | 		$content = $this->post_content; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 920 |  |  | 		if ( $len ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 921 |  |  | 			$content = wp_trim_words($content, $len); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 922 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 923 |  |  | 		if ( $page ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 924 |  |  | 			$contents = explode('<!--nextpage-->', $content); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 925 |  |  | 			$page--; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 926 |  |  | 			if ( count($contents) > $page ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 927 |  |  | 				$content = $contents[$page]; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 928 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 929 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 930 |  |  | 		$content = apply_filters('the_content', ($content)); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 931 |  |  | 		if ( $len == 0 && $page == 0 ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 932 |  |  | 			$this->_content = $content; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 933 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 934 |  |  | 		return $content; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 935 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 936 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 937 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 938 |  |  | 	 * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 939 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 940 |  |  | 	function get_paged_content() { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 941 |  |  | 		global $page; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 942 |  |  | 		return $this->get_content(0, $page); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 943 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 944 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 945 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 946 |  |  | 	 * Here is my summary | 
            
                                                                                                            
                            
            
                                    
            
            
                | 947 |  |  | 	 * @example | 
            
                                                                                                            
                            
            
                                    
            
            
                | 948 |  |  | 	 * ```twig | 
            
                                                                                                            
                            
            
                                    
            
            
                | 949 |  |  | 	 * This post is from <span>{{ post.get_post_type.labels.plural }}</span> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 950 |  |  | 	 * ``` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 951 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 952 |  |  | 	 * ```html | 
            
                                                                                                            
                            
            
                                    
            
            
                | 953 |  |  | 	 * This post is from <span>Recipes</span> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 954 |  |  | 	 * ``` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 955 |  |  | 	 * @return mixed | 
            
                                                                                                            
                            
            
                                    
            
            
                | 956 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 957 |  |  | 	public function get_post_type() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 958 |  |  | 		return get_post_type_object($this->post_type); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 959 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 960 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 961 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 962 |  |  | 	 * @return int | 
            
                                                                                                            
                            
            
                                    
            
            
                | 963 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 964 |  |  | 	public function get_comment_count() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 965 |  |  | 		if ( isset($this->ID) ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 966 |  |  | 			return get_comments_number($this->ID); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 967 |  |  | 		} else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 968 |  |  | 			return 0; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 969 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 970 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 971 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 972 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 973 |  |  | 	 * @param string $field_name | 
            
                                                                                                            
                            
            
                                    
            
            
                | 974 |  |  | 	 * @return mixed | 
            
                                                                                                            
                            
            
                                    
            
            
                | 975 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 976 |  |  | 	public function get_field( $field_name ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 977 |  |  | 		$value = apply_filters('timber_post_get_meta_field_pre', null, $this->ID, $field_name, $this); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 978 |  |  | 		if ( $value === null ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 979 |  |  | 			$value = get_post_meta($this->ID, $field_name); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 980 |  |  | 			if ( is_array($value) && count($value) == 1 ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 981 |  |  | 				$value = $value[0]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 982 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 983 |  |  | 			if ( is_array($value) && count($value) == 0 ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 984 |  |  | 				$value = null; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 985 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 986 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 987 |  |  | 		$value = apply_filters('timber_post_get_meta_field', $value, $this->ID, $field_name, $this); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 988 |  |  | 		return $value; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 989 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 990 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 991 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 992 |  |  | 	 * @param string $field_name | 
            
                                                                                                            
                            
            
                                    
            
            
                | 993 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 994 |  |  | 	function import_field( $field_name ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 995 |  |  | 		$this->$field_name = $this->get_field($field_name); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 996 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 997 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 998 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 999 |  |  | 	 * @internal | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1000 |  |  | 	 * @return mixed | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1001 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1002 |  |  | 	function get_format() { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1003 |  |  | 		return get_post_format($this->ID); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1004 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1005 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1006 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1007 |  |  | 	 * Get the CSS classes for a post. For usage you should use `{{post.class}}` instead of `{{post.post_class}}` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1008 |  |  | 	 * @internal | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1009 |  |  | 	 * @param string $class additional classes you want to add | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1010 |  |  | 	 * @see TimberPost::$class | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1011 |  |  | 	 * @example | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1012 |  |  | 	 * ```twig | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1013 |  |  | 	 * <article class="{{ post.class }}"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1014 |  |  | 	 *    {# Some stuff here #} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1015 |  |  | 	 * </article> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1016 |  |  | 	 * ``` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1017 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1018 |  |  | 	 * ```html | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1019 |  |  | 	 * <article class="post-2612 post type-post status-publish format-standard has-post-thumbnail hentry category-data tag-charleston-church-shooting tag-dylann-roof tag-gun-violence tag-hate-crimes tag-national-incident-based-reporting-system"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1020 |  |  | 	 *    {# Some stuff here #} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1021 |  |  | 	 * </article> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1022 |  |  | 	 * ``` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1023 |  |  | 	 * @return string a space-seperated list of classes | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1024 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1025 |  |  | 	public function post_class( $class='' ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1026 |  |  | 		global $post; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1027 |  |  | 		$old_global_post = $post; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1028 |  |  | 		$post = $this; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1029 |  |  | 		$class_array = get_post_class($class, $this->ID); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1030 |  |  | 		$post = $old_global_post; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1031 |  |  | 		if ( is_array($class_array) ){ | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1032 |  |  | 			return implode(' ', $class_array); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1033 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1034 |  |  | 		return $class_array; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1035 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1036 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1037 |  |  | 	// Docs | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1038 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1039 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1040 |  |  | 	 * @return array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1041 |  |  | 	 * @codeCoverageIgnore | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1042 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1043 |  |  | 	public function get_method_values() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1044 |  |  | 		$ret = parent::get_method_values(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1045 |  |  | 		$ret['author'] = $this->author(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1046 |  |  | 		$ret['categories'] = $this->categories(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1047 |  |  | 		$ret['category'] = $this->category(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1048 |  |  | 		$ret['children'] = $this->children(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1049 |  |  | 		$ret['comments'] = $this->comments(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1050 |  |  | 		$ret['content'] = $this->content(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1051 |  |  | 		$ret['edit_link'] = $this->edit_link(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1052 |  |  | 		$ret['format'] = $this->format(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1053 |  |  | 		$ret['link'] = $this->link(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1054 |  |  | 		$ret['next'] = $this->next(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1055 |  |  | 		$ret['pagination'] = $this->pagination(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1056 |  |  | 		$ret['parent'] = $this->parent(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1057 |  |  | 		$ret['path'] = $this->path(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1058 |  |  | 		$ret['prev'] = $this->prev(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1059 |  |  | 		$ret['terms'] = $this->terms(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1060 |  |  | 		$ret['tags'] = $this->tags(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1061 |  |  | 		$ret['thumbnail'] = $this->thumbnail(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1062 |  |  | 		$ret['title'] = $this->title(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1063 |  |  | 		return $ret; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1064 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1065 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1066 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1067 |  |  | 	 * Return the author of a post | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1068 |  |  | 	 * @api | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1069 |  |  | 	 * @example | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1070 |  |  | 	 * ```twig | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1071 |  |  | 	 * <h1>{{post.title}}</h1> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1072 |  |  | 	 * <p class="byline"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1073 |  |  | 	 *     <a href="{{post.author.link}}">{{post.author.name}}</a> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1074 |  |  | 	 * </p> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1075 |  |  | 	 * ``` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1076 |  |  | 	 * @return TimberUser|bool A TimberUser object if found, false if not | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1077 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1078 |  |  | 	public function author() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1079 |  |  | 		return $this->get_author(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1080 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1081 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1082 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1083 |  |  | 	 * Get the author (WordPress user) who last modified the post | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1084 |  |  | 	 * @example | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1085 |  |  | 	 * ```twig | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1086 |  |  | 	 * Last updated by {{ post.modified_author.name }} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1087 |  |  | 	 * ``` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1088 |  |  | 	 * ```html | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1089 |  |  | 	 * Last updated by Harper Lee | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1090 |  |  | 	 * ``` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1091 |  |  | 	 * @return TimberUser|bool A TimberUser object if found, false if not | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1092 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1093 |  |  | 	public function modified_author() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1094 |  |  | 		return $this->get_modified_author(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1095 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1096 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1097 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1098 |  |  | 	 * Get the categoires on a particular post | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1099 |  |  | 	 * @api | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1100 |  |  | 	 * @return array of TimberTerms | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1101 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1102 |  |  | 	public function categories() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1103 |  |  | 		return $this->get_terms('category'); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1104 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1105 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1106 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1107 |  |  | 	 * Returns a category attached to a post | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1108 |  |  | 	 * @api | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1109 |  |  | 	 * If mulitpuile categories are set, it will return just the first one | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1110 |  |  | 	 * @return TimberTerm|null | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1111 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1112 |  |  | 	public function category() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1113 |  |  | 		return $this->get_category(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1114 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1115 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1116 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1117 |  |  | 	 * Returns an array of children on the post as TimberPosts | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1118 |  |  | 	 * (or other claass as you define). | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1119 |  |  | 	 * @api | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1120 |  |  | 	 * @example | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1121 |  |  | 	 * ```twig | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1122 |  |  | 	 * {% if post.children %} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1123 |  |  | 	 *     Here are the child pages: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1124 |  |  | 	 *     {% for child in page.children %} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1125 |  |  | 	 *         <a href="{{ child.link }}">{{ child.title }}</a> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1126 |  |  | 	 *     {% endfor %} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1127 |  |  | 	 * {% endif %} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1128 |  |  | 	 * ``` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1129 |  |  | 	 * @param string $post_type _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 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1130 |  |  | 	 * @param string|bool $childPostClass _optional_ a custom post class (ex: 'MyTimberPost') to return the objects as. By default (false) it will use TimberPost::$post_class value. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1131 |  |  | 	 * @return array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1132 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1133 |  |  | 	public function children( $post_type = 'any', $childPostClass = false ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1134 |  |  | 		return $this->get_children( $post_type, $childPostClass ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1135 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1136 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1137 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1138 |  |  | 	 * Gets the comments on a TimberPost and returns them as an array of [TimberComments](#TimberComment) (or whatever comment class you set). | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1139 |  |  | 	 * @api | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1140 |  |  | 	 * @param int $count Set the number of comments you want to get. `0` is analogous to "all" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1141 |  |  | 	 * @param string $order use ordering set in WordPress admin, or a different scheme | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1142 |  |  | 	 * @param string $type 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 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1143 |  |  | 	 * @param string $status Could be 'pending', etc. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1144 |  |  | 	 * @param string $CommentClass 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) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1145 |  |  | 	 * @example | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1146 |  |  | 	 * ```twig | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1147 |  |  | 	 * {# single.twig #} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1148 |  |  | 	 * <h4>Comments:</h4> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1149 |  |  | 	 * {% for comment in post.comments %} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1150 |  |  | 	 * 	<div class="comment-{{comment.ID}} comment-order-{{loop.index}}"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1151 |  |  | 	 * 		<p>{{comment.author.name}} said:</p> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1152 |  |  | 	 * 		<p>{{comment.content}}</p> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1153 |  |  | 	 * 	</div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1154 |  |  | 	 * {% endfor %} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1155 |  |  | 	 * ``` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1156 |  |  | 	 * @return bool|array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1157 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1158 |  |  | 	public function comments( $count = 0, $order = 'wp', $type = 'comment', $status = 'approve', $CommentClass = 'TimberComment' ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1159 |  |  | 		return $this->get_comments($count, $order, $type, $status, $CommentClass); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1160 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1161 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1162 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1163 |  |  | 	 * 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). | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1164 |  |  | 	 * @api | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1165 |  |  | 	 * @example | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1166 |  |  | 	 * ```twig | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1167 |  |  | 	 * <div class="article"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1168 |  |  | 	 *     <h2>{{post.title}}</h2> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1169 |  |  | 	 *     <div class="content">{{ post.content }}</div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1170 |  |  | 	 * </div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1171 |  |  | 	 * ``` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1172 |  |  | 	 * @param int $page | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1173 |  |  | 	 * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1174 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1175 |  |  | 	public function content( $page = 0 ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1176 |  |  | 		return $this->get_content(0, $page); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1177 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1178 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1179 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1180 |  |  | 	 * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1181 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1182 |  |  | 	public function paged_content() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1183 |  |  | 		return $this->get_paged_content(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1184 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1185 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1186 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1187 |  |  | 	 * Get the date to use in your template! | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1188 |  |  | 	 * @api | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1189 |  |  | 	 * @example | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1190 |  |  | 	 * ```twig | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1191 |  |  | 	 * Published on {{ post.date }} // Uses WP's formatting set in Admin | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1192 |  |  | 	 * OR | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1193 |  |  | 	 * Published on {{ post.date | date('F jS') }} // Jan 12th | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1194 |  |  | 	 * ``` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1195 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1196 |  |  | 	 * ```html | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1197 |  |  | 	 * Published on January 12, 2015 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1198 |  |  | 	 * OR | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1199 |  |  | 	 * Published on Jan 12th | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1200 |  |  | 	 * ``` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1201 |  |  | 	 * @param string $date_format | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1202 |  |  | 	 * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1203 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1204 |  |  | 	public function date( $date_format = '' ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1205 |  |  | 		return $this->get_date($date_format); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1206 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1207 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1208 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1209 |  |  | 	 * Get the time to use in your template | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1210 |  |  | 	 * @api | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1211 |  |  | 	 * @example | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1212 |  |  | 	 * ```twig | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1213 |  |  | 	 * Published at {{ post.time }} // Uses WP's formatting set in Admin | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1214 |  |  | 	 * OR | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1215 |  |  | 	 * Published at {{ post.time | time('G:i') }} // 13:25 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1216 |  |  | 	 * ``` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1217 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1218 |  |  | 	 * ```html | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1219 |  |  | 	 * Published at 1:25 pm | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1220 |  |  | 	 * OR | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1221 |  |  | 	 * Published at 13:25 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1222 |  |  | 	 * ``` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1223 |  |  | 	 * @param string $time_format | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1224 |  |  | 	 * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1225 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1226 |  |  | 	public function time( $time_format = '' ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1227 |  |  | 		$tf = $time_format ? $time_format : get_option('time_format'); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1228 |  |  | 	 	$the_time = (string)mysql2date($tf, $this->post_date); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1229 |  |  | 	 	return apply_filters('get_the_time', $the_time, $tf); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1230 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1231 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1232 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1233 |  |  | 	 * @return bool|string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1234 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1235 |  |  | 	public function edit_link() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1236 |  |  | 		return $this->get_edit_url(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1237 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1238 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1239 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1240 |  |  | 	 * @api | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1241 |  |  | 	 * @return mixed | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1242 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1243 |  |  | 	public function format() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1244 |  |  | 		return $this->get_format(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1245 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1246 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1247 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1248 |  |  | 	 * get the permalink for a post object | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1249 |  |  | 	 * @api | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1250 |  |  | 	 * @example | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1251 |  |  | 	 * ```twig | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1252 |  |  | 	 * <a href="{{post.link}}">Read my post</a> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1253 |  |  | 	 * ``` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1254 |  |  | 	 * @return string ex: http://example.org/2015/07/my-awesome-post | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1255 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1256 |  |  | 	public function link() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1257 |  |  | 		return $this->get_permalink(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1258 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1259 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1260 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1261 |  |  | 	 * @param string $field_name | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1262 |  |  | 	 * @return mixed | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1263 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1264 |  |  | 	public function meta( $field_name = null ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1265 |  |  | 		if ( $field_name === null ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1266 |  |  | 			//on the off-chance the field is actually named meta | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1267 |  |  | 			$field_name = 'meta'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1268 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1269 |  |  | 		return $this->get_field($field_name); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1270 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1271 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1272 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1273 |  |  | 	 * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1274 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1275 |  |  | 	public function name(){ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1276 |  |  | 		return $this->title(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1277 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1278 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1279 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1280 |  |  | 	 * @param string $date_format | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1281 |  |  | 	 * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1282 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1283 |  |  | 	public function modified_date( $date_format = '' ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1284 |  |  | 		return $this->get_modified_date($date_format); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1285 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1286 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1287 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1288 |  |  | 	 * @param string $time_format | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1289 |  |  | 	 * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1290 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1291 |  |  | 	public function modified_time( $time_format = '' ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1292 |  |  | 		return $this->get_modified_time($time_format); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1293 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1294 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1295 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1296 |  |  | 	 * @api | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1297 |  |  | 	 * @param bool $in_same_cat | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1298 |  |  | 	 * @return mixed | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1299 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1300 |  |  | 	public function next( $in_same_cat = false ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1301 |  |  | 		return $this->get_next($in_same_cat); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1302 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1303 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1304 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1305 |  |  | 	 * @return array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1306 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1307 |  |  | 	public function pagination() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1308 |  |  | 		return $this->get_pagination(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1309 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1310 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1311 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1312 |  |  | 	 * Gets the parent (if one exists) from a post as a TimberPost object (or whatever is set in TimberPost::$PostClass) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1313 |  |  | 	 * @api | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1314 |  |  | 	 * @example | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1315 |  |  | 	 * ```twig | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1316 |  |  | 	 * Parent page: <a href="{{ post.parent.link }}">{{ post.parent.title }}</a> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1317 |  |  | 	 * ``` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1318 |  |  | 	 * @return bool|TimberPost | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1319 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1320 |  |  | 	public function parent() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1321 |  |  | 		return $this->get_parent(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1322 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1323 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1324 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1325 |  |  | 	 * Gets the relative path of a WP Post, so while link() will return http://example.org/2015/07/my-cool-post | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1326 |  |  | 	 * this will return just /2015/07/my-cool-post | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1327 |  |  | 	 * @api | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1328 |  |  | 	 * @example | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1329 |  |  | 	 * ```twig | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1330 |  |  | 	 * <a href="{{post.path}}">{{post.title}}</a> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1331 |  |  | 	 * ``` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1332 |  |  | 	 * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1333 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1334 |  |  | 	public function path() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1335 |  |  | 		return $this->get_path(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1336 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1337 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1338 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1339 |  |  | 	 * @deprecated 0.20.0 use link() instead | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1340 |  |  | 	 * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1341 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1342 |  |  | 	public function permalink() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1343 |  |  | 		return $this->get_permalink(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1344 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1345 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1346 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1347 |  |  | 	 * Get the previous post in a set | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1348 |  |  | 	 * @api | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1349 |  |  | 	 * @example | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1350 |  |  | 	 * ```twig | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1351 |  |  | 	 * <h4>Prior Entry:</h4> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1352 |  |  | 	 * <h3>{{post.prev.title}}</h3> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1353 |  |  | 	 * <p>{{post.prev.get_preview(25)}}</p> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1354 |  |  | 	 * ``` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1355 |  |  | 	 * @param bool $in_same_cat | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1356 |  |  | 	 * @return mixed | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1357 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1358 |  |  | 	public function prev( $in_same_cat = false ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1359 |  |  | 		return $this->get_prev($in_same_cat); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1360 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1361 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1362 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1363 |  |  | 	 * Get the terms associated with the post | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1364 |  |  | 	 * This goes across all taxonomies by default | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1365 |  |  | 	 * @api | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1366 |  |  | 	 * @param string|array $tax 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. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1367 |  |  | 	 * @param bool $merge Should the resulting array be one big one (true)? Or should it be an array of sub-arrays for each taxonomy (false)? | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1368 |  |  | 	 * @return array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1369 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1370 |  |  | 	public function terms( $tax = '', $merge = true ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1371 |  |  | 		return $this->get_terms($tax, $merge); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1372 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1373 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1374 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1375 |  |  | 	 * Gets the tags on a post, uses WP's post_tag taxonomy | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1376 |  |  | 	 * @api | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1377 |  |  | 	 * @return array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1378 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1379 |  |  | 	public function tags() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1380 |  |  | 		return $this->get_tags(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1381 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1382 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1383 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1384 |  |  | 	 * get the featured image as a TimberImage | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1385 |  |  | 	 * @api | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1386 |  |  | 	 * @example | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1387 |  |  | 	 * ```twig | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1388 |  |  | 	 * <img src="{{post.thumbnail.src}}" /> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1389 |  |  | 	 * ``` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1390 |  |  | 	 * @return TimberImage|null of your thumbnail | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1391 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1392 |  |  | 	public function thumbnail() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1393 |  |  | 		return $this->get_thumbnail(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1394 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1395 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1396 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1397 |  |  | 	 * 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. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1398 |  |  | 	 * @api | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1399 |  |  | 	 * @example | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1400 |  |  | 	 * ```twig | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1401 |  |  | 	 * <h1>{{ post.title }}</h1> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1402 |  |  | 	 * ``` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1403 |  |  | 	 * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1404 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1405 |  |  | 	public function title() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1406 |  |  | 		return $this->get_title(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1407 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1408 |  |  |  | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 1409 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 1410 |  |  |  |