the loop printing post in one grid

I am trying to print my wordpress post into 2/2 grid but I think my div’s are messed up.

<div class=”grid-container”>
<?php
if($query->have_posts()):
while($query->have_posts()):
$query->the_post();
if ( has_post_thumbnail() ):
echo ‘<div class=”grid”>’
?>

<?php the_post_thumbnail(‘medium_large’);
endif;
?>
<h1 class=”page-sub-main-header” style=”color: #00adee;”>
<a href=”<?php the_permalink(); ?>”>
<?php the_title() ?>
</a>
</h1>
<p><?php the_excerpt();?></p>
<div class=”footer-meta”>
<a href=”$query->the_permalink()”><?php the_category(); ?> </a>
<span> <?php the_date(‘d/m/Y’); ?></span>
</div>
<?php endwhile; ?>
<?php endif;
echo ‘</div>’;
?>
</div><!–grid container–>

What am I doing wrong?

Read more here:: the loop printing post in one grid

Leave a Reply

Your email address will not be published. Required fields are marked *