[wp-trac] [WordPress Trac] #12235: Display caption with the_post_thumbnail
WordPress Trac
noreply at wordpress.org
Wed Jun 29 17:28:02 UTC 2016
#12235: Display caption with the_post_thumbnail
---------------------------------------------+-----------------------
Reporter: hd-J | Owner: flixos90
Type: enhancement | Status: closed
Priority: normal | Milestone: 4.6
Component: Post Thumbnails | Version: 2.9
Severity: normal | Resolution: fixed
Keywords: has-patch has-unit-tests commit | Focuses:
---------------------------------------------+-----------------------
Changes (by joemcgill):
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"37915"]:
{{{
#!CommitTicketReference repository="" revision="37915"
Post Thumbnails: Add helper functions for attachment captions.
This adds three new functions for getting/displaying attachment captions:
* `wp_get_attachment_caption` - Retrieves a caption for a specific
attachment.
* `get_the_post_thumbnail_caption()` - Returns the post thumbnail caption.
* `the_post_thumbnail_caption()` - Displays the post thumbnail caption.
These are helpful for displaying a caption associated with an image
directly
in a template, rather than using the caption shortcode.
This also introduces two new filters:
* `wp_get_attachment_caption` - Filters the value of
`wp_get_attachment_caption()`.
* `the_post_thumbnail_caption` - Filters the display of the post thumbnail
caption.
`the_post_thumbnail_caption()` is automatically filtered by
`wptexturize()`,
`convert_smilies()`, and `convert_chars()` in `wp-includes/default-
filters.php`.
Props flixos90, joemcgill.
Fixes #12235.
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/12235#comment:33>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list