Sorry, I am using the relationship field in 1 CPT to get data from another (hope that makes sense?)
So I have the loop of CPT (1) and inside that done this;
<?php $dev_id = get_the_ID(); $doctors = get_posts(array( 'post_type' => 'house_types', 'meta_query' => array( array( 'key' => 'development_plots', // name of custom field 'value' => $dev_id, // matches exactly "123", not just 123. This prevents a match for "1234" 'compare' => 'LIKE' ) ) )); if( $doctors ): ?> <?php foreach( $doctors as $doctor ): ?> <?php $field = get_field_object( 'bedrooms', $doctor->ID ); $value = $field['value']; $label = $field['choices'][ $value ]; ?> <?php echo $value; ?> //these being 5 5 2 etc. <?php endforeach; ?> <?php endif; ?>
Where at the end I was hoping to use the PHP from my previous message to show the min/max of the select fields, e.g.
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!
© 2022 Advanced Custom Fields.