Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
ACF Repeater Headlines
<?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
You can’t perform that action at this time.