Forked from besimhu/ACF Post Meta - Repeater chaining.php
Created
April 30, 2016 05:14
-
-
Save dgoze/87ef3ac6ed5ff30ff5c7d964ebdaada7 to your computer and use it in GitHub Desktop.
Get ACF repeater within a repeater without using 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++ ) { | |
| // get our subsection repeater | |
| $subsection = get_post_meta( $pid, 'acf_repeater_slug_' . $i . '_acf_sub_repeater', true ); | |
| for( $j = 0; $j < $subsection; $j++ ) { | |
| // get field for subsection repeater | |
| $acf_field = get_post_meta( $pid, 'acf_repeater_slug_' . $i . '_acf_sub_repeater_' . $j . '_acf_field', true ); | |
| echo $acf_field; | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment