This code its not wordking for me, i have a custom post type called sp-event with a two custom post types called “local” y “visitante” and y am trying to show the values of these CF in a page (page.php) using a shortcode from another plugin.
this is my code
<?php
$posts = get_field('relacion');
if( $posts ): ?>
<?php foreach( $posts as $p ): ?>
<?php the_field('visitante', $p->ID); ?>
<?php endforeach; ?>
<?php endif; ?>
This code repeat the cf values for all elements of my custom post type and y wanna show only the assigned cf value for these element of my cpt (only one).
Any suggest?
Solved! Solution use get_post_meta
How? do you have any tutorial?