Im trying to follow some of your post and some issues that was solved here but im still seeing repeated title in my each post.
So I have this code:
<?php
$paged = get_query_var('paged') ? get_query_var('paged') : 1;
$post_article = new WP_Query([ 'post_type' => ['post'], 'paged' => $paged, 'pagination' => true ]);
while ( $post_article->have_posts() ) : $post_article->the_post();
$category = get_the_category();
$attached = get_field('featured_image');
$excerpt = get_field('post_excerpt'); ?>
<figure class="author-thumb">
<?php
$post_objects = get_field('post_author');
if( $post_objects ) :
foreach( $post_objects as $post ) : setup_postdata( $post );
$avatar = get_field('featured_image', $post_object->ID);
echo wp_get_attachment_image( $avatar['id'], [ 40, 40, true ], '', [ 'class' => 'uk-border-circle' ] );
endforeach; wp_reset_postdata();
else :
echo '<img src="../avatar.jpg" alt="">';
endif;
?>
</figure>
<article>
<div class="meta-title"><h1><?php the_title(); ?></h1></div>
</article>
<?php endwhile; wp_reset_query(); ?>
Though I can see the output, except for the title… Instead, it repeat the title to other posts.
Example of original line-up of title:
Title One | Title Two | Title Three … and so on
But when I execute the post_objects
this is what it looks like:
Title One | Title One | Title One … and so on
Note:
The post_object
was pulling another custom post type and wanted to display the avatar only.