Support

Account

Home Forums Front-end Issues Retrieving cell values from options table on specific page template Reply To: Retrieving cell values from options table on specific page template

  • Hi @cjg79

    I think it will be better if you set the ‘trip’ subfield as a post object field. That way, the options page and the trip page has a relation which you can use it later. After that, you can check the current price like this (it’s important to put it inside the loop):

    <?php while ( have_posts() ) : the_post(); ?>
        <div class="dynamic-price">
            <?php
            $costs = get_field('dates_costs_2016', 'options');
    
            foreach( $costs as $cost ) {
                if( $cost['trip']->ID == get_the_ID() ){
                    echo $cost['package_price'];
                }
            }
            ?>
        </div>
        <?php
        get_template_part( 'content', 'page' );
    endwhile; // end of the loop. ?>

    I hope this helps 🙂