-
-
Save dgoze/63735ecb8dcefcf10ba159742fdd91d9 to your computer and use it in GitHub Desktop.
Get ACF repeaters without using the ACF functions.
This file contains hidden or 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
| <?php | |
| // get post ID | |
| $pid = get_the_ID(); | |
| // get our repeater | |
| $repeater = get_post_meta( $pid, 'acf_repeater_slug', true ); | |
| if( !empty($repeater) ) { | |
| for( $i = 0; $i < $repeater; $i++ ) { | |
| $title = esc_html( get_post_meta( $pid, 'acf_repeater_slug_' . $i . '_acf_sub_field', true ) ); | |
| $perma = esc_url( get_post_meta( $pid, 'acf_repeater_slug_' . $i . '_acf_sub_field', true ) ); | |
| // build out the foreach | |
| echo '<a href="' . $perma . '">' . $title . '</a>'; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment