-1

Does anyone know how can I display in the loop thumbnail's name, alternative text, title, caption, url?

Thx for all advices and suggestions

2

Try the following code inside the loop and modify it as per requirement.

$thumb_id = get_post_thumbnail_id();
echo 'Name = '.  get_post_field( 'post_name', $thumb_id ).'<br />';
echo 'Alt = '.  get_post_meta( $thumb_id, '_wp_attachment_image_alt', true ).'<br />';
echo 'Title = '.  get_the_title( $thumb_id ).'<br />';
echo 'Caption = '.  get_post_field( 'post_excerpt', $thumb_id ).'<br />';
echo 'Description = '.  get_post_field( 'post_content', $thumb_id ).'<br />';
echo 'SRC = '. wp_get_attachment_url( $thumb_id ).'<br />';
echo 'URL = '. get_permalink( $thumb_id ).'<br />';
  • This is exactly what I need thank you very much :) – Jakub Kohout Jul 24 '12 at 13:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.