WordPress.org

Ready to get started?Download WordPress

Forums

loop image description (1 post)

  1. imbakeed
    Member
    Posted 1 year ago #

    function the_post_thumbnail_caption() {
    global $post;
    $thumbnail_id = get_post_thumbnail_id($post->ID);
    $thumbnail_image = get_posts(array('p' => $thumbnail_id, 'post_type' => 'attachment'));

    if ($thumbnail_image && isset($thumbnail_image[0])) {
    echo '<p>'.$thumbnail_image[0]->post_content.'</p>';
    }
    }

    I have found a code that would display the description of an image but it only displays the first description of an image. How can I put it in a loop for it to display all description of an image. I'm new in wordpress by the way and not really familiar in it's code. Any help would be much appreciated! Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic