簡體   English   中英

Twitter-bootstrap-3和Wordpress帖子顯示

[英]Twitter-bootstrap-3 and Wordpress post display

在這上面my我的頭,但這可能很簡單嗎? 我似乎無法弄清楚。 因此,我正在顯示使用Twitter-Bootstrap-3制作的自定義主題的博客文章,但在網格中顯示我的文章時遇到了問題。

所以我在頂部有一個最新的帖子,很好。 但是下面我打算顯示一個帖子網格,所以當添加一個新帖子時,它自然會到達頂部,右側也有一個側欄。 因此帖子的網格應為3,然后創建一個新行,依此類推。 如果我將它們設置為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(); ?>

通過研究,我猜想是否需要某種循環? 我不確定我的代碼從哪里開始...

可能是因為您需要將每個帖子都包裝為s col-md-3 ,而不是全部都包裝在一個帖子中?

所以看看這個...

<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(); ?

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM