在帖子中有多个精选图片,需要循环中所有或所有标题的描述。
答案 0 :(得分:0)
获取描述的功能
>Bob address postcode Sam address postcode
以下是调用此函数的声明
/**
* Retrieve Post Thumbnail Description.
*
* @param string $post_type The post type.
* @param string $id The id used to register the thumbnail.
* @param int $post_id Post ID.
* @return string
*/
public static function the_post_thumbnail_description($post_type, $id, $post_id) {
$post_id = (NULL === $post_id) ? get_the_ID() : $post_id;
$postThumbnailID = get_post_meta($post_id, "{$post_type}_{$id}_thumbnail_id", true);
$description = get_post($postThumbnailID)->post_content;
echo $description;
}