Php 为什么我在循环中的帖子占据了整个屏幕的宽度?
在我的帖子列表页面上,我想在每行显示3篇帖子。(仅限桌面视图) 在下面的代码中,每一篇文章都占据了整个屏幕的宽度,每一篇文章都从一个新行开始。我怎样才能解决这个问题 下面是my index.php中最初以循环为目标的代码Php 为什么我在循环中的帖子占据了整个屏幕的宽度?,php,wordpress,loops,Php,Wordpress,Loops,在我的帖子列表页面上,我想在每行显示3篇帖子。(仅限桌面视图) 在下面的代码中,每一篇文章都占据了整个屏幕的宽度,每一篇文章都从一个新行开始。我怎样才能解决这个问题 下面是my index.php中最初以循环为目标的代码 <section id="portfolio" class="wow fadeIn hide" data-wow-duration="2s"> <div class="container
<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>
<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(); ?> -->
下面是我的content-grid.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>
<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(); ?> -->
您的
元素可能不是基于网格的。也许可以把它放在你的专栏课里。开始和结束都是一种享受,非常感谢!