Usage
nebula()->post_meta($meta, $options)
Parameters
$meta
(Required) (String) The desired metadata.
Default: None
$options
(Optional) (Array) An array of options for the associated metadata
Default: None
Parameter Notes
The $options array parameters differ for each metadata function. Some only accept a boolean for an icon while others allow a full array of options. Refer to the individual metadata functions for which options are available.
Demo
Using post_meta:
Using individual Nebula post meta functions with options:
Other Nebula meta functions:
Source File
Located in /libs/Functions.php on line 595.
1 Hook
Find these filters and actions in the source code below to hook into them. Use do_action() and add_filter() in your functions file or plugin.
Filters
"pre_post_meta"Need a new filter hook? Request one here.
Actions
This function has no action hooks available. Request one? public function post_meta($meta, $options=array()){
$override = apply_filters('pre_post_meta', null, $meta, $options);
if ( isset($override) ){return;}
if ( $meta === 'date' || $meta === 'time' || $meta === 'on' || $meta === 'day' || $meta === 'when' ){
echo $this->post_date($options);
} elseif ( $meta === 'author' || $meta === 'by' ){
echo $this->post_author($options);
} elseif ( $meta === 'type' || $meta === 'cpt' || $meta === 'post_type' ){
echo $this->post_type($options);
} elseif ( $meta === 'categories' || $meta === 'category' || $meta === 'cat' || $meta === 'cats' || $meta === 'in' ){
echo $this->post_categories($options);
} elseif ( $meta === 'tags' || $meta === 'tag' ){
echo $this->post_tags($options);
} elseif ( $meta === 'dimensions' || $meta === 'size' ){
echo $this->post_dimensions($options);
} elseif ( $meta === 'exif' || $meta === 'camera' ){
echo $this->post_exif($options);
} elseif ( $meta === 'comments' || $meta === 'comment' ){
echo $this->post_comments($options);
} elseif ( $meta === 'social' || $meta === 'sharing' || $meta === 'share' ){
$this->social(array('facebook', 'twitter', 'linkedin', 'pinterest'), 0);
}
}
Override
To override this PHP function, use this hook in your child theme or plugin ("my_custom" can be changed):
add_filter('pre_post_meta', 'my_custom_post_meta', 10, 3); //The last integer must be 1 more than the actual parameters
function my_custom_post_meta($null, $meta, $options){ //$null is required, but can be ignored
//Write your own code here
return true; //Return true to prevent the original function from running afterwords
}
You can completely disable this PHP function with a single line actions:
add_filter('pre_post_meta', '__return_false');