Created
July 11, 2012 21:23
-
-
Save johnbhartley/3093658 to your computer and use it in GitHub Desktop.
Custom Meta Box - Image via Tammy Hart
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// image | |
case 'image': | |
$image = get_template_directory_uri().'/images/image.png'; | |
echo '<span class="custom_default_image" style="display:none">'.$image.'</span>'; | |
if ($meta) { $image = wp_get_attachment_image_src($meta, 'medium'); $image = $image[0]; } | |
echo '<input name="'.$field['id'].'" type="hidden" class="custom_upload_image" value="'.$meta.'" /> | |
<img src="'.$image.'" class="custom_preview_image" alt="" /><br /> | |
<input class="custom_upload_image_button button" type="button" value="Choose Image" /> | |
<small> <a href="#" class="custom_clear_image_button">Remove Image</a></small> | |
<br clear="all" /><span class="description">'.$field['desc'].''; | |
break; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment