Filter results according to subfield value
-
This repeater field is being called from another page with ID of 8.
This repeater field is called: ‘location’
Within it I have several subfields like:’name’, ‘city’ and ‘phone’.I want to display any results where ‘city’ matches value of ‘denver’
Would this be considered a filter or conditional?
This seems like it should be simple, but very confusing to me…
Any help or direction is much appreciated!`
// The following displays all<?php $other_page = 8; ?>
<?php
if( have_rows(‘location’, $other_page2) ): ?><?php while( have_rows(‘location’, $other_page) ): the_row(); ?>
<h4><?php the_sub_field(‘name’); ?> (<?php the_sub_field(‘city’); ?>)</h4>
<p><strong>Phone:</strong> <?php the_sub_field(‘phone’); ?> <br>
<strong>Fax:</strong> <?php the_sub_field(‘fax’); ?> </p><?php endwhile; ?>
<?php endif; ?>
`
- The topic ‘Filter results according to subfield value’ is closed to new replies.