Hello,
I have created a post-object field and would like to output this as an unordered list. The list is also generated. However, there are empty bullets between all entries. How can I prevent this?
Here is my code:
<?php $post_objects = get_field( 'field1' ); ?> <?php if ( $post_objects ): ?>
<?php foreach ( $post_objects as $post ): ?> <?php setup_postdata( $post ); ?>
"><?php the_title(); ?>
<?php endforeach; ?>
<?php wp_reset_postdata(); ?> <?php endif; ?>
Here you can see the wrong display of the list:

Many thanks for your help.
Michael
There is something missing from the code you attempted to include.
Sorry, here’s the complete code.:
<?php $post_objects = get_field( 'field1' ); ?>
<?php if ( $post_objects ): ?>
<ul>
<?php foreach ( $post_objects as $post ): ?>
<?php setup_postdata( $post ); ?>
<li>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
<li>
<?php endforeach; ?>
</ul>
<?php wp_reset_postdata(); ?>
<?php endif; ?>
Okay, I found the mistake. It was just a silly missing / in the closing
-tag.