When using a modal window such as lightbox or shadowbox to display a post's images, client would like to be able to choose the background color that would be used for the modal window according to the image to be shown: color would be either black, white or grey.

I'm thinking such hack should be done via a plugin but i didn't find any, so i guess i should do it myself. It scarces me a bit: where should i store the chosen value? What hooks ? Any help would be welcome.


You can store the chosen color in a meta field. We have a question about adding a custom field to attachments, it contains an example. The hooks you need are attachment_fields_to_edit and attachment_fields_to_save.

| improve this answer | |

You don't need a plugin for this.

After uploading and inserting an image into a post, you can then click on the top left icon of the picture which brings you a new panel. Click on the "Advanced Settings" tab, there you can add html classes to the img tag.

You can then put in your css that bg1 = grey, bg2 = black, …

More info here > http://en.support.wordpress.com/images/image-settings/

| improve this answer | |
  • Not as userfriendly as required by customer but a good idea nonetheless (customer wants a 1-click option GUI ) – pixeline May 19 '11 at 5:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.