doushaju4901 2014-05-26 13:22
浏览 45
已采纳

Twitter-bootstrap-3和Wordpress帖子显示

Scratching my head over this one but it is probably simple? I cannot seem to figure it out. So I am showing blog posts using a custom theme I have made with Twitter-Bootstrap-3 but having a problem showing my posts in a grid.

so i have a latest post at the top which is fine. but below I am aiming to show a grid of posts so when a new one is added it naturally goes to the top, I also have a side bar on the right. so the grid of posts should be 3 across and then create a new row and so on. My posts are just creating new rows now matter if i set them to be say col-md-3?

    <?php endwhile; wp_reset_query(); ?>

            <h2 class="blog-title">Past Posts</h2>


             <div class = "col-md-3">

                <?php while(have_posts()) : the_post(); ?>
                <?php the_post_thumbnail( 'medium', $attr ); ?> 
                <h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
                <p><?php the_excerpt(); ?></p>
                <p class="text-muted">Posted by <?php the_author(); ?> on <?php the_time('F jS, Y'); ?></p>
                <p><?php comments_number( 'no responses', '1 response', '% responses' ); ?>.</p>
                 <hr>
                <?php endwhile; wp_reset_query(); ?>

From researching I guessing there is a requirement for a loop of some sort? I am unsure form my code where to begin with that...

  • 写回答

1条回答 默认 最新

  • duanlin6989 2014-05-26 14:03
    关注

    probably because you need to wrap each post is s col-md-3, not all of the in a single one?

    So have a look at this...

    <h2 class="blog-title">Past Posts</h2>
    
    <?php while(have_posts()) : the_post(); ?>
    <div class = "col-md-3">
        <?php the_post_thumbnail( 'medium', $attr ); ?> 
        <h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
        <p><?php the_excerpt(); ?></p>
        <p class="text-muted">Posted by <?php the_author(); ?> on <?php the_time('F jS, Y'); ?></p>
        <p><?php comments_number( 'no responses', '1 response', '% responses' ); ?>.</p>
        <hr>
    </div>
    <?php endwhile; wp_reset_query(); ?
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 c程序不知道为什么得不到结果
  • ¥40 复杂的限制性的商函数处理
  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置