Getting the post title to show as a title attribute of the thumbnail
I have a slideshow showing the first 4 news posts. I want to output the featured image (thumbnail) to have a title attribute which is the post title. So far, using the code bellow the closest I’ve got it is to just remove the title … can anyone tell me where I’m going wrong with this array and what I need to do to get it to display the post’s title?
Thanks for any help.
<?php the_post_thumbnail('', array('title' => trim(strip_tags( $attachment->post_title )),)); ?>
- The topic ‘Getting the post title to show as a title attribute of the thumbnail’ is closed to new replies.