Post Content driven by Meta Data


I’m wondering if there is a way to have post content driven by Custom Fields / Meta Data while editing in Cornerstone?

For example, check out this sample post page here:

I’d like to keep this generic format for most posts, so I was thinking I could create a layout I like and duplicate the posts (using a plugin), only updating the meta data to change the content displayed. So, if I created a custom field called “WHAT_WE_LOVE_ABOUT_IT” and set the value to “This great bodysuit…”, it would populate it where the text currently is. I’d then have meta called “CURRENT_DEALS”, “THE_FINE_PRINT”, etc.

The alternative route is to create custom template PHP files which will take a decent bit more effort, but may result in a cleaner site? If duplicating posts doesn’t bog down wordpress, it’s likely the easier route if I can get meta data to appear in the body content of my Cornerstone modified posts.


Hi there,

Thanks for writing in.

You can use ACF Pro within cornerstone, and you can place them as a shortcode. The ACF Pro is a bundled plugin and you can install it through X’s addons page in admin.

Please check these

Or just like you said, you can create custom templates and display ACF fields. But we can’t provide support for custom development so you may wish to hire a developer.


Hello again,

Thanks for the response, but I don’t think this plugin does what I am attempting to do.

One way I’ve tried to do this with a Cornerstone Element was to insert Raw Data, but it doesn’t appear to support PHP.

If I could do something like the following:

<?php echo get_post_meta($post->ID, 'key', true); ?>

Except in specific spots on a post, this is ultimately what I’m trying to achieve. The ‘key’ will return different data for every single post, so I don’t think ACF Pro accomplishes this, as it appears to show the same content just in multiple locations on your website.

Is there any way to achieve what I described?



You can try creating a shortcode by adding the code below in your child theme’s functinos.php

function my_func( $atts ) {	
	return get_post_meta($post->ID, 'key', true); 
add_shortcode( 'myshortcode', 'my_func' );

You can then add this in your text or raw element.


Hope that helps.


Thank you! Yes with this I am able to retrieve a meta tag, however it appears $post->ID is not able to identify the calling post to the shortcode.

Is there something I can put into the post to insert the post ID dynamically? I set up the shortcode to accept a parameter post_id, but right now I have to hard code it. So here is what it looks like in my raw element:

[what_we_love_about_it post_id=“76”]

If I can auto-generate the post_id this will be fully functional! Thanks for getting me this far :slight_smile:

NEVERMIND! I changed the PHP function to:

return get_post_meta(get_the_ID(), ‘key’, true);

get_the_ID() is able to resolve it! Thanks , this is now working !!

Glad to hear it’s sorted.