2017-09-18 19 views
-2

投稿に複数の特集画像があり、ループ内のすべてまたはタイトルの説明が必要です。説明Wordpressで複数の投稿サムネイル画像のタイトルまたは説明を取得

以下
/** 
    * 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; 
    } 

を取得する

答えて

0

機能は

MultiPostThumbnails::the_post_thumbnail_description(get_post_type(), 'feature-image-'.$i.'', Null).'<br>'; 
この関数を呼び出すための文です
関連する問題