Opened 12 years ago
Closed 12 years ago
#24348 closed enhancement (invalid)
Consider the post thumbnail in get_the_post_format_image()
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.6 |
Component: | Post Formats | Keywords: | has-patch dev-feedback needs-refresh |
Focuses: | Cc: |
Description
get_the_post_format_image()
makes valiant attempts to locate an image for use with a post of image post format.
The function first attempts to find suitable data in the post format meta field. If no image is found there, it grabs the first attached image. Finally, if all else fails, it will look in the post content to use the first image inserted in the content.
I think that the function should also consider grabbing the post's featured image as a fallback. I would prioritize this right after the post format meta data.
I think this is important in that it seems that using the featured image was a common practice for adding an image to a post of image post format. I would think that this would help improve back compat for themes that have used this practice. Moreover, since grabbing an attached image or an image inserted in the post content is merely a guess at the right image to use for the post, I think that using the featured image is a better guess than either of these methods.
Attachments (3)
Change History (14)
#2
@
12 years ago
Using the featured image should be the last option. The featured image is mean to represent the entire post, alone or along with an excerpt, in multi post views. Many themes don't show them in singe post views, as the featured image is not considered to to a part of the post content.
The first attached or inserted image should be a higher priority than the featured image when looking for a post format image.
#3
@
12 years ago
Hi @knutsp! Thanks for the response! I think what you are saying makes a lot of sense. I would be fine with the Featured Image being the last resort. I still think that it is a legitimate image source to consider when trying to find the an image to display for the image post format.
#4
@
12 years ago
24348.1.patch will grab the Featured Image as the last option for finding an image related to the post. Additionally, I added the @return docblock information and made sure to always return a string value.
#5
@
12 years ago
+1 for this.
Many of my imagined use cases for post formats are associated with mobile. The current WordPress iOS app has Set Featured Image right below the Post Format selection, which encourages me to use that to post quick images. I was surprised last night to find out that an image post showed up blank in Twenty Thirteen on any view. Workflow and UI may change in the app over time, but it makes sense to keep looking through the chain if an image has not yet been found.
24348.patch shows how I think this could be implemented.