Codigo:
Código PHP:
add_action('admin_menu', 'custom_fields_price');
function custom_fields_price() {
add_meta_box('price','Precio del Objeto','fn_price','post','normal','high');
}
function fn_price() {
global $wpdb, $post;
$value = get_post_meta($post->ID, price, true);
echo '<label for="image_es">Precio</label>
<input type="text" name="price" id="price" value="'.htmlspecialchars($value).'" style="width: 100px;" /> €';
}
Código PHP:
add_action('publish_post', 'save_price');
function save_price() {
global $wpdb, $post;
if (!$post_id) $post_id = $_POST['post_ID'];
if (!$post_id) return $post;
$price= $_POST['price'];
update_post_meta($post_id, 'price', $price);
}