예제 #1
0
 function estetico_action_save_post($post_id)
 {
     $post_type = estetico_get_post_type();
     $meta_boxes = estetico_get_custom_meta_boxes();
     if (!isset($meta_boxes[$post_type])) {
         return true;
     }
     foreach ($meta_boxes[$post_type] as $box) {
         $box_id = $box['id'];
         if (isset($_POST[$box_id])) {
             $value = $_POST[$box_id];
             if (isset($box['before_save']) && function_exists($box['before_save'])) {
                 call_user_func($box['before_save'], $box_id, $post_id);
             }
             $readonly = isset($box['readonly']) ? $box['readonly'] : false;
             if (false === $readonly) {
                 update_post_meta($post_id, $box_id, $value);
             }
         }
     }
 }
예제 #2
0
function estetico_get_custom_metabox_field_title($group, $name)
{
    $meta_boxes = estetico_get_custom_meta_boxes();
    foreach ($meta_boxes[$group] as $box) {
        if ($box['id'] == $name) {
            return $box['title'];
        }
    }
}