I'm building a page in Wordpress, and am using the pods + visual composer plugins.
What I want to do is to show a Pods field on the VC Grid Builder template. Using the code below I can show the field if I set a static Id, but I can't find a way to get the ID dynamically.
I'm newish to php, but so far I know {{ post_data:ID }} displays the ID after rendering, so I guess that's why the code is failing.
add_shortcode( 'vc_post_field', 'vc_post_field_render' );
function vc_post_field_render() {
$id = '{{ post_data:ID }}'; // I want to get the grid post id at this point
$var = pods_field( 'pet', $id, 'comment', true ); //should return comment
return $var; //should return comment returns nothing
}
An alternative may be to pass the post ID through the shortcode slug
[vc_post_field id="22"]
But I cant get it on the frontend either....
Any idea how to get this?
Their source: http://ift.tt/1HY8SPZ
If nothing works I'll have to go JS way.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire