S
S
ScartFM2015-10-28 00:54:40
WordPress
ScartFM, 2015-10-28 00:54:40

Wordpress get and display "caption" attribute of post thumbnail?

You can get the alt attribute of a wordpress post thumbnail like this:
$id_thumb = get_post_thumbnail_id();
$image_alt = get_post_meta($id_thumb, '_wp_attachment_image_alt', true);
How can I get the <signature> (sign) attribute?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
bulba_man, 2016-03-03
@bulba_man

not this way. signature - no tag.
the signature is written to the database as an ordinary post, therefore, you need to receive it accordingly:

$thumb_img = get_post( get_post_thumbnail_id() ); 
echo $thumb_img->post_excerpt; // та самая подпись

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question