WordPress.org

Ready to get started?Download WordPress

Forums

Display Media Caption with Featured Image (4 posts)

  1. r3p0d3p0t
    Member
    Posted 3 years ago #

    Me:
    Searching for a way to retrieve a Featured Image's caption for the front end.

    That is, my theme’s user:

    • Uploads an image to the Media Library and defines that image's Title ("Football"), Alternate Text, Caption, and Description (all on the Edit Media page).
    • Creates a Page named "Toejam"
    • Chooses "Set Featured Image" and selects that recently uploaded 'Football' image to "use as featured" in 'full' size.
    • Expects to be finished with the work

    I have sorted out how to display the Featured Images of every Page with a Featured Image as links to the respective Page's permalinks. However, I am having great difficulty displaying each of those Featured Images' Caption or Description as either an "alt" attribute in the HTML or preferably in it's own <p> tag.

    A link to an image from the Meda page:
    image

    I've been struggling to use:
    featured-image-display-image-caption

    An example of what I want on the front end:

    <div>
    <a href="ex.amp.le"><img width="600" height="200" src="ex.amp.le/football.jpg" class="attachment-full wp-post-image" alt="Future Media Caption" title="Future Media Caption" /></a>
    <p>Future Media Caption</p>
    </div>
    <div>
    <a href="ex.amp.le"><img width="600" height="200" src="ex.amp.le/football.jpg" class="attachment-full wp-post-image" alt="Future Media Caption" title="Future Media Caption" /></a>
    <p>Future Media Caption</p>
    </div>

    You: Providing helpful suggestions.
    Thank you!

  2. r3p0d3p0t
    Member
    Posted 3 years ago #

    For this particular project, I also wanted to style the "Future Media Caption" text. For instance, I wanted to produce:
    <p><p>Future <em>Media</em> Caption</p

    I don't know if Media Library images accept html tags, but I decided the best way to accomplish this is to create a post with a featured image for each image I want to display, using the post content as that image's caption.

  3. LeeLeeTechie
    Member
    Posted 3 years ago #

    Apparently it's not possible. At least according to this forum.

    I haven't tried it yet but the the forum mentioned this plugin that converts the alt tag info into a caption. I'm trying to do the same thing you are, so hopefully it works.

  4. Miriam53
    Member
    Posted 2 years ago #

    What is the use of the description, caption, etc. in the Image Edit Page?
    Is this for search engine recognition?
    Thanks, the newbie.

Topic Closed

This topic has been closed to new replies.

About this Topic