在我的帖子列表页面上,我想在每行上显示3个帖子。 (仅限桌面视图)
使用以下代码,每个帖子占据屏幕的整个宽度,并且每个帖子都从新行开始。我该如何解决?
这是我的index.php中最初针对循环的代码。
<section id="portfolio" class="wow fadeIn hide" data-wow-duration="2s">
<div class="container">
<div class="row">
<?php
endif;
/* Start the Loop */
while ( have_posts() ) :
the_post();
get_template_part( 'template-parts/content', "grid" );
endwhile;
else :
endif;
?>
</div>
</div>
</section>
这是我的content-grid.php中显示循环内容的代码。
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<div class="col-lg-4 col-md-12 col-sm-12"> <!-- Start of featured project column --->
<a href="<?php the_permalink(); ?>">
<div class="img-container thumbnail">
<?php if ( has_post_thumbnail() ) the_post_thumbnail(); ?>
<div class="hover-block">
<h3 class="project-name"><?php the_title(); ?></h3>
</div>
</div>
</a>
</div> <!-- End of featured project column --->
</article><!-- #post-<?php the_ID(); ?> -->