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 π
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
π Weβre excited to announce we've released Composer support for installing ACF PRO.
— Advanced Custom Fields (@wp_acf) January 31, 2023
π #ComposerPHP fans rejoice!
β¨ Please see the release post for all the details and full instructions. https://t.co/ebEfp61nlR
© 2023 Advanced Custom Fields.
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.