1. Create the Custom Meta
2. Add some content to the new Custom Meta field
3. Add the following shortcode to the page, and modify the “eg-my-custom-meta” part to whatever handle was chosen for the Custom Meta previously created.
[grid_meta key=”eg-my-custom-meta”]
4. Add the following code to your theme’s “functions.php” file
add_shortcode('grid_meta', 'print_grid_meta');
function print_grid_meta($atts) {
global $post;
$meta = get_post_meta($post->ID);
extract(shortcode_atts(array('key' => ''), $atts));
if($key && array_key_exists($key, $meta)) {
return $meta[$key][0];
}
}
Add Custom Meta to Page or Post via Shortcode