Expanding new Media Uploader in WordPress 3.5

You can add inputs and fields to attachments by hooking into attachment_fields_to_edit. This will add fields to both the modal as well as the attachment editor. The catch I found is that WordPress (if anyone has experienced differently PLMK) doesn’t save the extra fields data so you have to hook into a couple other items. … Read more

Add custom Attachment Display Setting for images

This will add a field in the attachment edit screen for applying a class to the img tag. function IMGattachment_fields($form_fields, $post) { $form_fields[“imageClass”][“label”] = __(“Image Class”); $form_fields[“imageClass”][“value”] = get_post_meta($post->ID, “_imageClass”, true); return $form_fields; } add_filter(“attachment_fields_to_edit”, “IMGattachment_fields”, null, 2); function my_image_attachment_fields_save($post, $attachment) { if ( isset($attachment[‘imageClass’]) ) update_post_meta($post[‘ID’], ‘_imageClass’, $attachment[‘imageClass’]); return $post; } add_filter(“attachment_fields_to_save”, “my_image_attachment_fields_save”, null, … Read more