[wp-trac] [WordPress Trac] #21126: Different ID on "Set featured image" link if there is already an image set

WordPress Trac wp-trac at lists.automattic.com
Sat Jun 30 22:02:55 UTC 2012


#21126: Different ID on "Set featured image" link if there is already an image set
-------------------------+-----------------------------
 Reporter:  ryanimel     |      Owner:
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  General      |    Version:  3.4
 Severity:  normal       |   Keywords:  has-patch
-------------------------+-----------------------------
 I ran into a situation where I wanted to target the "Set featured image"
 link text in the featured image metabox. The "Set featured image" link
 displays and has an id of "set-post-thumbnail". When you set the
 thumbnail, the link still has an ID of "set-post-thumbnail" though now it
 is wrapping around the thumbnail image rather than the "Set featured
 image" text. Then a second link is added to remove the featured image with
 the id of "remove-post-thumbnail".

 In my situation I wanted to target the "Set featured image" link (with the
 text) and the "Remove featured image" link separately, but this was
 tricker than it needed to be because the "Set featured link" keeps the
 same id of set-post-thumbnail when it is wrapped around the thumbnail
 image.

 Beyond my specific issue, I think it could be argued that this link
 deserves a specific id, since the action the link is performing is
 modifying the featured image more than it is setting it.

 So I've included a patch here that will modify the $set_thumbnail_link
 variable when the $thumbnail_id is present and change the link's id to
 modify-post-thumbnail. I'm not sure if it's the most elegant/clever way to
 achieve what I'm after, but I know it gets the job done.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/21126>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list