Retrieving featured image's caption
-
I am new to WordPress and PHP.
Here is the code I have:while( $rposts->have_posts() ) { $portfoliocount++; $rposts->the_post(); $large_image = wp_get_attachment_image_src( get_post_thumbnail_id(get_the_ID()), 'fullsize', false, '' ); $large_image = $large_image[0]; $image = portfolio_aq_resize( $large_image, $imgwidth, $imgheight, true ); ... <img src="<?php echo $image; ?>" alt="<?php the_title(); ?>" /> <a href="<?php echo $large_image; ?>" title='' class="prettyPhoto[<?php echo $portfoliocount ?>]">
I need to figure out what to put in the title=” to retrieve the given attachment (featured) picture’s caption.
I have tried <php echo $large_image[‘caption’] ?> and <php echo $image[‘caption’] ?>
But it outputed h, which I think comes from the first letter of the image link (http….)
It needs to work based on the current defined variables or by defining a new variable. Existing variables cannot be modified since the rest of the code is based on them.
Any help? Thank you.
Thank you.
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Retrieving featured image's caption’ is closed to new replies.