首页 > 解决方案 > 尝试使用 bootstrap 和 wordpress 创建 3 列

问题描述

我正在尝试使用引导程序和 Wordpress 创建 3 列。我希望我的类别帖子分为 3 列。但是,当我查看类别页面时,它们不是 3 列,而是在一列中,彼此堆叠。我究竟做错了什么?这是我的archive.php 模板

<?php if(have_posts() ): while(have_posts()): the_post();?>
<div class="container">
<div class="row">
    <div class="col-md-4 post-card">

            <?php if(has_post_thumbnail()):?>

    <a href="<?php the_permalink();?>"><img src="<?php the_post_thumbnail_url('blog-small');?>" alt="<?php the_title();?>" class="img-fluid mb-3 img-thumbnail">

<?php endif;?>

        <a href="<?php the_permalink();?>"><h2 class="h2 text-center mb-3"><?php the_title();?></h2>

        <a href="<?php the_permalink();?>" class="btn btn-success">Read more</a>
    </div>
</div> </div>

标签: phphtmlcsswordpressbootstrap-4

解决方案


推荐阅读