简体   繁体   English

如何在图像下显示多个相等列的WordPress博客帖子?

[英]How to display WordPress blog posts with multiple equal columns under image?

I am trying to display all blog posts like a magazine article. 我试图显示所有博客文章,如杂志文章。 Please see link below for the exact format. 请参阅下面的链接了解确切的格式。

http://imgur.com/a/jKAlM http://imgur.com/a/jKAlM

Single.php single.php中

<div class="container-fluid">
    <div class="row-fluid">
        <div class="col-xs-12 main-blog">

            <?php 

        if(have_posts()):

            while(have_posts()): the_post(); ?> 

                <?php the_title('<h1 class="entry-title">', '</h1>'); ?>

                <article id="post-<?php the_ID(); ?>" <?php post_class(); ?


                <div class="article-single">

                <p><?php the_content(); ?></p>

                </article>

            <?php endwhile;

        endif;


        ?>

        </div>
    </div>
</div>

CSS CSS

.article_single {

    column-width: 150px;
    -webkit-column-width: 150px;
    -moz-column-width: 150px;
    column-gap: 30px;
    -webkit-column-gap: 30px;
    -moz-column-gap: 30px;
    font-family: Garamond;
    column-count: 3;


}

Whatever I do to the content also resizes the image. 无论我对内容做什么,也会调整图像大小。 How can I display the content without messing up the image? 如何在不弄乱图像的情况下显示内容?

Not sure exactly what your problem is since there's no call to show the featured image here, but it's worth pointing out that your: 不确定你的问题究竟是什么,因为这里没有显示特色图片的电话,但值得指出你的:

<div class="article-single">

Has no closing </div> tag anywhere. 在任何地方都没有结束</div>标签。 That might be borking up your layout. 这可能是你的布局。 Seems like it should come right before your </article> 好像它应该在你的</article>

I resolved it by adding the featured image call. 我通过添加精选图片调用解决了这个问题。 Thanks! 谢谢!

<div class="container-fluid">
    <div class="row-fluid">
        <div class="col-xs-12 main-blog">



            <?php 

        if(have_posts()):

            while(have_posts()): the_post(); ?> 

                <?php the_title('<h1 class="entry-title">', '</h1>'); ?>

                <article id="post-<?php the_ID(); ?>" <?php post_class(); ?   >>








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

                    <div class="text-center"><?php the_post_thumbnail('large'); ?></div>

                <?php endif; ?>

                <div class="article_single">

                <p><?php the_content(); ?></p>


                </article>





            <?php endwhile;

        endif;


        ?>

    </div>
</div>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM