I’m trying to get some custom fields inside my custom grid builder. I have added some extra taxonomy and would like to add custom data to display. I’ve read your article here: https://kb.wpbakery.com/docs/developers-how-tos/adding-custom-shortcode-to-grid-builder/ and when implementing it, I’m getting a problem when trying to get the id of the current post ID. I know the code is as follows:
add_shortcode( 'vc_post_id', 'vc_post_id_render' );
function vc_post_id_render() {
return '<h2>{{ post_data:ID }}</h2>'; // usage of template variable post_data with argument "ID"
}
The thing is that the {{ post_data:ID }} cannot be saved to a variable to later get the post and play with it as such:
$post_id = '{{ post_data:ID }}';
$post = get_post($post_id);
as it will fail. Could you please tell me how to get the current post ID as a variable so I can show custom data on the grid?
Thank you very much.