diff --git a/multi-post-thumbnails.php b/multi-post-thumbnails.php index 817d49d..bd8b3b8 100644 --- a/multi-post-thumbnails.php +++ b/multi-post-thumbnails.php @@ -372,6 +372,44 @@ public static function get_post_thumbnail_url($post_type, $id, $post_id = 0, $si return $url; } + + /** + * + * @param string $post_type The post type. + * @param string $id The id used to register the thumbnail. + * @return thumbnail title. + */ + public static function get_post_thumbnail_title($post_type, $id, $post_id = null) { + if (!$post_id) { + $post_id = get_the_ID(); + } + $post_thumbnail_id = self::get_post_thumbnail_id($post_type, $id, $post_id); + $attachment_title = ''; + if ($post_thumbnail_id) { + $attachment_meta = get_post($post_thumbnail_id); + $attachment_title = $attachment_meta->post_title; + } + return $attachment_title; + } + + /** + * + * @param string $post_type The post type. + * @param string $id The id used to register the thumbnail. + * @return thumbnail description. + */ + public static function get_post_thumbnail_description($post_type, $id, $post_id = null) { + if (!$post_id) { + $post_id = get_the_ID(); + } + $post_thumbnail_id = self::get_post_thumbnail_id($post_type, $id, $post_id); + $attachment_excerpt = ''; + if ($post_thumbnail_id) { + $attachment_meta = get_post($post_thumbnail_id); + $attachment_excerpt = $attachment_meta->post_excerpt; + } + return $attachment_excerpt; + } /** * Output the post thumbnail HTML for the metabox and AJAX callbacks