Created
August 13, 2020 09:29
-
-
Save ivo-ivanov/49420d881f58a72b298ed73ea91bc58a to your computer and use it in GitHub Desktop.
Check the value of a sub field, outside the while loop. #wordpress #acf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$found = false; | |
$value = 'Your value'; | |
while ( have_rows( 'your_repeater_field' ) ) : the_row(); | |
if ( get_sub_field( 'your_sub_field' ) == $value ) : | |
$found = true; | |
endif; | |
endwhile; | |
if ( $found ) { | |
// True | |
} else { | |
// False | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment