Solution:
The issue is caused by the use of PHP short tags (<?) instead of full PHP tags (<?php).
If your server doesn’t have short tags enabled, PHP won’t interpret them correctly. This can cause errors, such as reaching endwhile before recognizing the opening PHP tag.
To fix this, replace all <? with <?php. For example:
<?php while ( $query->have_posts() && $count != 3 ) : $query->the_post(); ?>
<?php $count++; ?>
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-4 col-lg-4">
<?php the_post_thumbnail('medium'); ?>
</div>
<div class="col-xs-12 col-sm-12 col-md-8 col-lg-8 post-info">
<h3>
<a title="<?php echo get_the_title(); ?>" href="<?php echo get_permalink(); ?>">
<?php the_title(); ?>
</a>
</h3>
<time><?php the_date(); ?></time>
<div class="category">
<!-- Example category output (optional) -->
<!-- <p>Category:
<a title="Posts about <?php echo get_the_category()[0]->name; ?>"
href="<?php echo get_category_link( get_the_category()[0]->term_id ); ?>">
<?php the_category(', ', 'single', get_the_ID()); ?>
</a>
</p> -->
</div>
<a title="<?php echo get_the_title(); ?>" href="<?php echo get_permalink(); ?>"
class="col-12 btn btn-block btn-info">Read More..</a>
</div>
</div>
<?php endwhile; ?>
<?php wp_reset_query(); ?>