Opened 15 years ago
Closed 15 years ago
#10928 closed task (blessed) (fixed)
Canonical Post Thumbnails
Reported by: | markjaquith | Owned by: | markjaquith |
---|---|---|---|
Milestone: | 2.9 | Priority: | high |
Severity: | normal | Version: | |
Component: | Post Thumbnails | Keywords: | |
Focuses: | Cc: |
Description
Many themes and plugins use the concept of a post thumbnail — a representative image for the post. Generally, these are made by laboriously inserting a Custom Field with a full image URL.
WordPress would benefit from having an authoritative way of defining a post thumbnail that uses a GUI instead of custom fields, and specifies an image attachment ID instead of a URL so that themes may get that image in any size they want.
Attachments (9)
Change History (45)
#7
@
15 years ago
If you wanted to change the class attribute, this is what you'd have to write, with the current hooks:
add_action('begin_fetch_post_image_html', 'begin_post_image_hook'); add_action('end_fetch_post_image_html', 'end_post_image_hook'); function begin_post_image_hook() { add_filter('wp_get_attachment_image_attributes', 'post_image_hook'); } function end_post_image_hook() { remove_filter('wp_get_attachment_image_attributes', 'post_image_hook'); } function post_image_hook($attr) { $attr['class'] .= ' alignright'; return $attr; }
It works, but it's kind of verbose.
#12
@
15 years ago
When deleting an attachment, all post thumbnails from that attachment should be cleared.
#14
@
15 years ago
Pages could also use thumbnails. See page_thumbnails.php.diff
#17
@
15 years ago
[12060], therefore revert_page_scripts.diff.
#20
follow-up:
↓ 21
@
15 years ago
There are few problems I find in implementation of Post Thumbnails though. When you upload image, it only shows Insert into post at bottom which should also show Use for Thumbnail. So you will have to first upload image, browse to Media Library and then select Use for Thumbnails. Few clicks can be saved here.
And if a image has been selected as thumbnail and you go to media library second time, Use for Thumbnail is shown against that image too.
#21
in reply to:
↑ 20
@
15 years ago
Replying to navjotjsingh:
There are few problems I find in implementation of Post Thumbnails though. When you upload image, it only shows Insert into post at bottom which should also show Use for Thumbnail. So you will have to first upload image, browse to Media Library and then select Use for Thumbnails. Few clicks can be saved here.
I agree that there should be a way to set a thumbnail without having to go to the Media Library tab.
And if a image has been selected as thumbnail and you go to media library second time, Use for Thumbnail is shown against that image too.
use_as_thumbnail.diff fixes this. Also does a little cleaning.
#22
@
15 years ago
use_as_thumbnail.2.diff moves the "Use as thumbnail" link next to the "Insert into post" button.
#23
@
15 years ago
use_as_thumbnail.2.diff
removes the ability to set thumbnails from the post gallery.
#24
@
15 years ago
Turns out that's not a regression, and this optimizes for the upload > set as thumbnail flow which I think will be more common.
#26
follow-up:
↓ 27
@
15 years ago
Can't say this patch [12081] will save clicks but now has increased one more click to set as thumbnail. Now the Use as Thumbnail appears only when you click Show in Media Library against the Image and that too as a link instead of a nice button? Only the second problem appears to have been fixed from my last post.
And why does Use as Thumbnail changes to Use for Thumbnail on setting a thumbnail? Link should disappear when it gets set as Thumbnail.
#27
in reply to:
↑ 26
@
15 years ago
Replying to navjotjsingh:
Can't say this patch [12081] will save clicks but now has increased one more click to set as thumbnail. Now the Use as Thumbnail appears only when you click Show in Media Library against the Image and that too as a link instead of a nice button? Only the second problem appears to have been fixed from my last post.
Not all clicks are created equal: the previous click involved loading a new tab, which is much slower than expanding a media item. The flow will probably be improved with the new Media UI in a future release.
And why does Use as Thumbnail changes to Use for Thumbnail on setting a thumbnail? Link should disappear when it gets set as Thumbnail.
Yes, this should be fixed.
#35
@
15 years ago
- Cc aaron@… added
- Resolution fixed deleted
- Status changed from closed to reopened
It would be really nice if a plugin could enable support of this as well. For example, I want http://wordpress.org/extend/plugins/featured-content-showcase/ to be able to enable the functionality so I don't have to tell the user to add a line to their theme's functions.php file during installation, but the require_if_theme_supports() call in wp-settings happens too early.
If this should be a different ticket, let me know and I'll open one.
(In [12007]) First pass on canonical post thumbanils. Admin-side GUI only. Theme functions to follow. see #10928