Hi elliot
Thanks for your hints. This set me on the right track.
I had to change two things. First i had to use
$post_objects = get_field('snippet_list',false,false);
to get the correct arry of post Ids
Second i had to use
foreach( $post_objects as $postID):
$post = get_post($postID);
to get the correct posts.
So the whole code looks like this at the end:
<div class="row product-single-row snippets">
<?php $post_objects = get_field('snippet_list',false,false);
if( $post_objects ):
$counter_tab = 0; ?>
<div class="span12">
<ul class="nav nav-tabs nav-snippets">
<?php foreach( $post_objects as $postID):
$post = get_post($postID);
$counter_tab++;
setup_postdata($post); ?>
<li><a href="#snippet<?php echo $counter_tab ?>" data-toggle="tab"><?php the_field('snippet_label'); ?></a></li>
<?php endforeach;
$counter_tab = 0; ?>
</ul>
<div class="tab-content">
<?php foreach( $post_objects as $postID):
$post = get_post($postID);
$counter_tab++;
setup_postdata($post); ?>
<div class="tab-pane fade" id="snippet<?php echo $counter_tab ?>">
<?php echo get_the_content(); ?>
</div>
<?php endforeach; ?>
</div>
</div>
<?php wp_reset_postdata();
endif; ?>
</div>
I’m not sure, this is the optimal solution, but at least it works the way I expect.
Thanks again. I realy appreciate your help.