Home › Forums › General Issues › Relationship field multiple: get position › Reply To: Relationship field multiple: get position
You would need to add a counter and you would need to pass that counter to the template part. Passing arguments to the template part is a relatively new feature of get_template_part()
<?php
$counter = 1;
foreach ($featured_posts as $post) {
setup_postdata($post);
$args = array('counter' => $counter);
get_template_part('template-parts/content-archive', NULL, $args);
$counter++;
}
wp_reset_postdata();
?>
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.