Ejemplo n.º 1
0
 /**
  * Get single meta box by name
  *
  * @param int    $post_id
  * @param string $control_name valid meta box name
  * @param bool   $remove_first remove first element
  *
  * @return array|boolean
  *
  * @access   public
  */
 public function get($post_id, $control_name, $remove_first = true)
 {
     $post_meta = get_post_meta($post_id, $this->getId(), true);
     if ($post_meta && RecursiveArray::searchKey($control_name, $post_meta)) {
         $meta_boxes = RecursiveArray::searchRecursive($post_meta, $control_name);
         if (\count($meta_boxes) == 1 && \is_array($meta_boxes) && $remove_first) {
             return $meta_boxes[0];
         }
         if (is_array($meta_boxes)) {
             $meta_boxes = RecursiveArray::removeEmpty($meta_boxes);
         }
         return $meta_boxes;
     } else {
         return false;
     }
 }