Make WordPress Core

Opened 13 years ago

Closed 11 years ago

#21126 closed enhancement (worksforme)

Different ID on "Set featured image" link if there is already an image set

Reported by: ryanimel's profile ryanimel Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.4
Component: General Keywords: has-patch
Focuses: Cc:

Description

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.

Attachments (1)

postthumbnailid.diff (693 bytes) - added by ryanimel 13 years ago.

Download all attachments as: .zip

Change History (2)

#1 @nacin
11 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to worksforme
  • Status changed from new to closed

I believe 3.5 changed this.

Note: See TracTickets for help on using tickets.