You need to pass in the author ID properly.
This line:
<?php echo get_the_author_meta('display_name', $author_id); ?>
Should be this:
<?php echo get_the_author_meta( 'display_name', $mypost->post_author ); ?>
Alternatively you could use setup_postdata()
in your foreach loop to setup the global $post variable and make use of the template tag functions without having to pass in the IDs.
global $post;
foreach ( $myposts as $post ) { setup_postdata( $post ); ?>
<div class="col-md-4 a-article-row">
<?php
echo get_the_author_meta('display_name');
?>
<?php $thumb = wp_get_attachment_image_src( get_post_thumbnail_id($mypost->ID), 'full' );?>
<?php if(has_post_thumbnail()) { ?>
<div class="archive-thumb-img" style="background-image: url('<?php echo $thumb['0'];?>')"></div>
<?php } else { ?>
<div class="archive-thumb-img"></div>
<?php } ?>
<div class="article-detail">
<div class="category">
<?php
foreach($categories as $category) {
if($category->parent){
echo $category->name;
}
}
?>
</div>
<div class="a-article-title">
<a href="https://wordpress.stackexchange.com/questions/315210/<?php the_permalink($mypost);?>" title="<?php the_title(); ?>">
<?php echo mb_strimwidth( get_the_title(), 0, 45, '...' ); ?>
</a>
</div>
<div class="author">
<?php echo get_the_author_meta('display_name', $author_id); ?>
</div>
</div>
</div>
<?php } wp_reset_postdata();