Support

Account

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();
    ?>