How to get the alt text of an image
-
Some things that should be really simple to do with WP are hard to achieve. I’ve been looking for this on Google for the last 3 hours and I still couldn’t get anything that works. My problem is that I need to take full control of the size of feature images and the easiest way I found to do that is using the following code:
<img title="" alt="" class="wp-post-image" src="<?=wp_get_attachment_url( get_post_thumbnail_id() ); ?>" style="width:100%; height:auto;">
The problem? The alt attribute will stay empty and I don’t want that. So I need a function that allows me to get the alt of a feature image.
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘How to get the alt text of an image’ is closed to new replies.