[wp-trac] [WordPress Trac] #28461: Add a fallback parameter to get_the_post_thumbnail() to find images
WordPress Trac
noreply at wordpress.org
Thu Jun 5 06:55:47 UTC 2014
#28461: Add a fallback parameter to get_the_post_thumbnail() to find images
-----------------------------+-----------------------------
Reporter: krogsgard | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Post Thumbnails | Version: 3.9
Severity: normal | Keywords:
Focuses: template |
-----------------------------+-----------------------------
In the 3.6 cycle, there was a lot of talk about grabbing various media
types from the content for post format handling. #22960 is basically the
end of that conversation, and includes a lot more stuff. #23593 is also
related, but ended up getting closed in favor of #22960, which died with
the post format UI.
Within that realm, the `get_the_image()` function from Justin Tadlock's
Get The Image (https://github.com/justintadlock/get-the-image) plugin came
up a bit. It's a super handy function. Although, it was mostly discussed
as a piece of post formats. You can see it's got a whole bunch of
functionality, but I'm mostly interested in its ability to find a fallback
image in the content.
I'd like to see something like `get_the_image()` be able to be called via
some kind of parameter within `get_the_post_thumbnail()` and therefore
`the_post_thumbnail()`.
Justification: There are times in building out a theme where you'd want
the **exact** featured image or none at all (like a big wide header banner
or something), but other times it's great to have any 'ole fallback, like
a more traditional square thumbnail on blog archives.
In these situations, often which are theme driven, and not custom site
driven, it'd be great for the theme developer to be able to assign
fallback rules when they call `the_post_thumbnail` itself. Whether that's
through a new parameter, or maybe just an additional key / value for
'fallback' to the `attr` parameter... I don't know. But for a theme (where
most image sizes are registered anyway) to be able to define fallback
behavior for those same image sizes would be powerful.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/28461>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list