Support

Account

Home Forums Front-end Issues Trying to show custom field value in another custom post type

Solved

Trying to show custom field value in another custom post type

  • 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?

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘Trying to show custom field value in another custom post type’ is closed to new replies.