[wp-trac] [WordPress Trac] #12235: Display caption with the_post_thumbnail
WordPress Trac
noreply at wordpress.org
Mon Apr 18 14:18:49 UTC 2016
#12235: Display caption with the_post_thumbnail
-----------------------------+-----------------------------
Reporter: hd-J | Owner:
Type: feature request | Status: new
Priority: normal | Milestone: Future Release
Component: Post Thumbnails | Version: 2.9
Severity: normal | Resolution:
Keywords: needs-patch | Focuses:
-----------------------------+-----------------------------
Changes (by flixos90):
* keywords: => needs-patch
Comment:
Replying to [comment:15 johnbillion]:
> I don't believe there's need for a new argument for this function at
all. You have much more control over the output by outputting the caption
yourself in your template file. Should we add arguments for every field?
(caption, title, description).
>
> We could probably add some new template tags to help with this (I have
some that I use in my theme framework) but extra arguments for
`the_post_thumbnail()` isn't the way to go.
I agree with this approach. Showing the featured image caption is a very
specific need which should not be supported directly by
`the_post_thumbnail()`, other image functions do not include a caption
either.
However a new template tag for this could be valuable. Maybe we should
first add a general function like `wp_get_image_caption()` to get the
caption for an image, outsourcing code from the `img_caption_shortcode()`
function (for the `wp_caption` shortcode) and calling the function from
there instead. We could then use that new function by a possible
`get_post_thumbnail_caption()`.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/12235#comment:20>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list