How to get the “alt” and “title” information for an image?
-
I’m trying to find out how to get the specific information entered for each image.
Scenario goes like this…
1. User uploads an image as usual and enter the Alternative text and Title for the image.
2. The image is later shown using custom fields in the template.The code below will get the page/post title for both “alt” and “title”, but that’s not what I want.
…
'" alt="' . get_the_title() . '" title="' . get_the_title() . '"
…I’m looking for a tag to replace get_the_title() for both “alt” and “title”. get_the_image_title and get_the_image_alt_title would be two good ones for my purpose 🙂
Been looking allover in the codex without success. Anyone have a clue on this one?
There must be a function for this, right? Or do I really have to make custom fields for “alt” and “title” as well?
- The topic ‘How to get the “alt” and “title” information for an image?’ is closed to new replies.