I want to fetch complete data of an image. Which and how should I use any function? Title shows title of post but I want Title of image to be displayed. What should I do?
Asked
Active
Viewed 54 times
0
-
How do you want to fetch for images? bulk? or by post_id? or by image id? or any displaied image? – jnhghy - Alexandru Jantea Oct 09 '13 at 12:21
1 Answers
0
It depends on how you would like to attach your image in post/page.
If you go through the Featured Image, below code will help you:
<?php if ( has_post_thumbnail()) : ?>
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" >
<?php the_post_thumbnail(); ?>
</a>
<?php endif; ?>
Thanks.

Krunal Shah
- 2,083
- 12
- 27