I’ve at the moment added a {custom} meta area to add a media file (picture). I can efficiently add the add button to show and it really works however I am having issues saving the sector when updating the web page.
Code I am utilizing to create and show the sector:
<?php
$picture = get_template_directory_uri().'/photographs/picture.png';
echo '<span class="custom_default_image" model="show:none">'.$picture.'</span>';
if ($meta)
{
$picture = wp_get_attachment_image_src($meta, 'medium'); $picture = $picture[0];
}
echo '<enter title="image-upload-one" sort="hidden" class="custom_upload_image worth="'.$meta.'" />
<img src="'.$picture.'" class="custom_preview_image" alt="" />
<br />
<enter class="custom_upload_image_button button" sort="button" worth="Select Picture" />
<br/>
<small>
<a href="#" class="custom_clear_image_button">Take away Picture</a>
</small>
<br clear="all" />
<span class="description">'.$area['desc'].'</span>'; ?>
The above code is from:
http://code.tutsplus.com/tutorials/reusable-custom-meta-boxes-part-3-extra-fields–wp-23821
I am unable to discover a strategy to save the enter.
I’ve created easy textual content fields/texttext space fields and might save them no downside utilizing the operate beneath however having issues saving picture fields:
<?php if (isset($_POST['text-two']))
{
update_post_meta($post_id,'textTwo', esc_attr($_POST['text-two']));
} ?>
Any assist a lot appreciated.