1
votes

I'm trying to display animated image captions from a slideshow created with a wordpress plugin, meteor slides.

I copied the following function into my functions.php file:

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 '<span>'.$thumbnail_image[0]->post_excerpt.'</span>';
     }
}

Unfortunately the function doesn't seem to get triggered. You can see what I'm talking about here on my testing website: http://mywptestsite.is-great.org/lalala/

What am I doing wrong here? Thanks Kim

1
Are you talking about this working slideshow of yours? :) I don't get it which part of your page doesn't work. :) - Mr.TK
The problem is that captions are not displayed on the slideshow. I'm trying first to have them displayed with the function above but I'm missing something here! - Kimberley Furson

1 Answers

0
votes

Try this solution: CLICK :)

<?php

/**
 * Display Post Image and Caption
 *
 * @link http://www.billerickson.net/wordpress-featured-image-captions/
 * @author Bill Erickson
 *
 */
function be_display_image_and_caption() {
    echo '<div class="featured-image">';
    the_post_thumbnail();
    echo '<span class="caption">' . get_post( get_post_thumbnail_id() )->post_excerpt .     '</span>';
    echo '</div>';
}