WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 2 down vote accepted

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.

share|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/

share|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 posting your answer, you agree to the privacy policy and terms of service.

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