Support

Account

Home Forums ACF PRO Get the post id from user selection using relationship? Reply To: Get the post id from user selection using relationship?

  • I have the relationship field set to use the Post ID.

    Here’s my code where I need the variable “$theids” at line 8 to output the post id’s:

    <?php 
    $theids = get_field(post_id_one);
    $latest_title = get_field(latestposts_title);
    if( get_field('show_posts') )
    {
        echo '<div class="container"><div class="acsc-outer">
    <div class="fancyheader"><span class="acsc-title">' . $latest_title . '</span></div>
    </div>' . do_shortcode( '[display-posts include_excerpt="true" id="'.$theids.'"]' ) . '</div>';
    }
    ?>