Hi Community Members,
I have a small problem,
I have a CF in posts and I want to display that fields values in another custom post type. Actually the code to get values from another post is below.
<p><?php the_field('field_name', 123); ?></p>
But this is not dynamic way, I have custom template for my CPT if I use that above code it display the same value in all posts.
My question is how can I append post id dynamically, because different CPT posts have to get values from the related posts.
Anybody have suggestions.
You would need to set up a relationship between the posts, for example a post object field. Then you’d get the post ID from the current post and use that post ID to get the value from the other post.
If you don’t mind would you provide me a example code.
Hey, Thanks I got the result. And we can achieve this with relationship field?