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
andattachment_fields_to_save
.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/