Example #1
0
/**
 * Get Meta Access Function
 *
 * Get the post meta out of the DB table {prefix}_postmeta.
 * Though it is only a interface for acpt_get::meta it is the preferred method to
 * access data within theme template and plugin files.
 *
 * @param string $name
 * @param string $fallBack
 * @param bool $groups
 * @param null $id
 *
 * @return mixed|null|string
 */
function acpt_meta($name = '', $fallBack = '', $groups = true, $id = null)
{
    return acpt_get::meta($name, $fallBack, $groups, $id);
}
 /**
  * Get data using the groups bracket syntax.
  *
  * @param $name
  * @param $id
  *
  * @return mixed|null
  */
 private static function get_groups($name, $id)
 {
     $data = get_post_meta($id);
     if (!empty($data)) {
         $data = acpt_get::get_meta_data($name, $data);
     } else {
         $data = null;
     }
     return $data;
 }
Example #3
0
 /**
  * Get Field Value
  *
  * Get the value if it is a post type or another page form
  *
  * @param mixed|string $field
  * @param string $group
  * @param string $sub
  *
  * @return mixed|null|string
  */
 protected function get_field_value($field, $group, $sub)
 {
     global $post;
     $group = $this->get_opt_by_test($group, $this->group);
     if (isset($post->ID)) {
         $value = acpt_get::meta("{$group}[{$field}]{$sub}");
     } else {
         $value = acpt_get::option("{$group}[{$field}]{$sub}");
     }
     return $value;
 }