Ejemplo n.º 1
0
 function cruxstore_meta($key, $args = array(), $post_id = null)
 {
     if (function_exists('rwmb_meta')) {
         /**
          * If meta boxes is registered in the backend only, we can't get field's params
          * This is for backward compatibility with version < 4.8.0
          */
         $field = RWMB_Helper::find_field($key);
         if (false === $field || isset($args['type'])) {
             return apply_filters('rwmb_meta', RWMB_Helper::meta($key, $args, $post_id));
         }
         $meta = in_array($field['type'], array('oembed', 'map')) ? rwmb_the_value($key, $args, $post_id, false) : rwmb_get_value($key, $args, $post_id);
         return apply_filters('rwmb_meta', $meta, $key, $args, $post_id);
     } else {
         return null;
     }
 }
Ejemplo n.º 2
0
 /**
  * Shortcode to display meta value
  *
  * @param array $atts Shortcode attributes, same as meta() function, but has more "meta_key" parameter
  *
  * @see meta() function below
  *
  * @return string
  */
 function rwmb_meta_shortcode($atts)
 {
     $atts = wp_parse_args($atts, array('post_id' => get_the_ID()));
     if (empty($atts['meta_key'])) {
         return '';
     }
     $field_id = $atts['meta_key'];
     $post_id = $atts['post_id'];
     unset($atts['meta_key'], $atts['post_id']);
     return rwmb_the_value($field_id, $atts, $post_id, false);
 }