Created
December 15, 2019 07:49
-
-
Save mennwebs/b890dccfe3306deedf0b98cf48f3f1ca to your computer and use it in GitHub Desktop.
ACF Repeater Headlines
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 | |
| /** | |
| * ACF Repeater Field : headlines | |
| * ACF Sub Field: headline (Post ID) | |
| */ | |
| $posts = array(); | |
| if (have_rows('headlines')) { | |
| while (have_rows('headlines')) { | |
| the_row(); | |
| array_push($posts, get_sub_field('headline')); | |
| } | |
| } | |
| $args = array( | |
| 'post__in' => $posts, | |
| 'orderby' => 'post__in' | |
| ); | |
| $the_query = new WP_Query($args); | |
| while ($the_query->have_posts()) { | |
| $the_query->the_post(); | |
| get_template_part('template-parts/content', 'headline'); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment