0

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?

shweta
  • 19
  • 1
  • 5

1 Answers1

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