Add Custom Meta to Page or Post via Shortcode

The following example shows how you can add the grid’s Custom Meta content to the page via shortcode. This is useful if you want to make editing content easy for your client.

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

Further Resources for Web Design and Development Enthusiasts

Alright! We've embarked on quite an adventure exploring the realms of this topic. But why stop there? The world of web design and development is vast, and there's always more to learn and discover. Let's dive into some resources that'll keep your knowledge fresh, your skills sharp, and your passion ignited:

The Author


Strength does not come from winning. Your struggles develop your strengths. When you go through hardships and decide not to surrender, that is strength.

Liked this Post?
Please Share it!