/** * @param Post $post * * @return PostMeta|null */ public function getThumbnailPostId(Post $post) { return $this->getPostMeta($post->getId(), '_thumbnail_id', true); }
/** * @param string $permalinkStructure * @param Post $post * * @return string */ public function replacePostArguments($permalinkStructure, Post $post) { $postDate = $post->getDate(); $permalinkStructure = str_replace('%year%', $postDate->format('Y'), $permalinkStructure); $permalinkStructure = str_replace('%monthnum%', $postDate->format('m'), $permalinkStructure); $permalinkStructure = str_replace('%day%', $postDate->format('d'), $permalinkStructure); $permalinkStructure = str_replace('%post_id%', $post->getId(), $permalinkStructure); $permalinkStructure = str_replace('%postname%', $post->getName(), $permalinkStructure); return $permalinkStructure; }