列出更改单个帖子标题的wordpress页面

I've created a widget that displays all posts from a single category (current category of post) and what happens is it works great, but changes the post title on the single post to the same title as the latest title of the last post ID.

It seems like I am assigning the current post title to the post title of the foreach loop I created somewhere, but I can't figure out where.

Here is the code:

 <?php
$post_id = get_the_ID();
$args = array( 'category' => 2, 'post_type' =>  'post', 'order' => 'ASC' ); 
$postslist = get_posts( $args );    

foreach ($postslist as $post) { 

$class = '';
if ($post_id == $post->ID){ $class = 'class="current"'; }
?>  


<li><a href="<?php the_permalink(); ?>" <?php echo $class ?>><?php the_title(); ?></a></li>   
<?php }; ?> 

Simply calling

wp_reset_postdata();

after the foreach statement fixed everything.