Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 立柱在两列中没有正确对齐_Php_Wordpress - Fatal编程技术网

Php 立柱在两列中没有正确对齐

Php 立柱在两列中没有正确对齐,php,wordpress,Php,Wordpress,我在编码方面没有太多经验,但我正在努力学习: <?php if ( have_posts() ) : ?> <?php /* Start the Loop */ ?> <?php while ( have_posts() ) : the_post(); ?> <?php if ( !$wp_query->current_post > 0 ): ?> <?php get_

我在编码方面没有太多经验,但我正在努力学习:

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

        <?php /* Start the Loop */ ?>
        <?php while ( have_posts() ) : the_post(); ?>
      <?php if ( !$wp_query->current_post > 0 ): ?>
    <?php get_template_part( 'content', get_post_format() ); ?>
    <?php else: ?>
    <div class="post-row col-lg-6 col-md-6 col-sm-6 col-xs-12">
<a href="<?php the_permalink(); ?>" rel="bookmark"><?php if ( the_post_thumbnail('post-thumb') ) { has_post_thumbnail();} ?></a>
<?php the_title( sprintf( '<h1 class="rest-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h1>' ); ?>
    <span class="meta-data"><?php the_time('F jS, Y') ?></span>
    </div>

    <?php endif; ?>
我正试图从wordpress.org编辑主题Bhost,将第一篇文章单独显示为普通文章,其余部分分为两列

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

        <?php /* Start the Loop */ ?>
        <?php while ( have_posts() ) : the_post(); ?>
      <?php if ( !$wp_query->current_post > 0 ): ?>
    <?php get_template_part( 'content', get_post_format() ); ?>
    <?php else: ?>
    <div class="post-row col-lg-6 col-md-6 col-sm-6 col-xs-12">
<a href="<?php the_permalink(); ?>" rel="bookmark"><?php if ( the_post_thumbnail('post-thumb') ) { has_post_thumbnail();} ?></a>
<?php the_title( sprintf( '<h1 class="rest-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h1>' ); ?>
    <span class="meta-data"><?php the_time('F jS, Y') ?></span>
    </div>

    <?php endif; ?>
我的问题是:当文章的标题太长时,会在文章之间产生一个间隙。index.php中的代码:

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

        <?php /* Start the Loop */ ?>
        <?php while ( have_posts() ) : the_post(); ?>
      <?php if ( !$wp_query->current_post > 0 ): ?>
    <?php get_template_part( 'content', get_post_format() ); ?>
    <?php else: ?>
    <div class="post-row col-lg-6 col-md-6 col-sm-6 col-xs-12">
<a href="<?php the_permalink(); ?>" rel="bookmark"><?php if ( the_post_thumbnail('post-thumb') ) { has_post_thumbnail();} ?></a>
<?php the_title( sprintf( '<h1 class="rest-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h1>' ); ?>
    <span class="meta-data"><?php the_time('F jS, Y') ?></span>
    </div>

    <?php endif; ?>
更好地显示在屏幕截图上:

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

        <?php /* Start the Loop */ ?>
        <?php while ( have_posts() ) : the_post(); ?>
      <?php if ( !$wp_query->current_post > 0 ): ?>
    <?php get_template_part( 'content', get_post_format() ); ?>
    <?php else: ?>
    <div class="post-row col-lg-6 col-md-6 col-sm-6 col-xs-12">
<a href="<?php the_permalink(); ?>" rel="bookmark"><?php if ( the_post_thumbnail('post-thumb') ) { has_post_thumbnail();} ?></a>
<?php the_title( sprintf( '<h1 class="rest-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h1>' ); ?>
    <span class="meta-data"><?php the_time('F jS, Y') ?></span>
    </div>

    <?php endif; ?>
我不知道如何解决这个问题:

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

        <?php /* Start the Loop */ ?>
        <?php while ( have_posts() ) : the_post(); ?>
      <?php if ( !$wp_query->current_post > 0 ): ?>
    <?php get_template_part( 'content', get_post_format() ); ?>
    <?php else: ?>
    <div class="post-row col-lg-6 col-md-6 col-sm-6 col-xs-12">
<a href="<?php the_permalink(); ?>" rel="bookmark"><?php if ( the_post_thumbnail('post-thumb') ) { has_post_thumbnail();} ?></a>
<?php the_title( sprintf( '<h1 class="rest-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h1>' ); ?>
    <span class="meta-data"><?php the_time('F jS, Y') ?></span>
    </div>

    <?php endif; ?>
我尝试了教程4和夫妇更多,但它是相同的差距一遍又一遍

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

        <?php /* Start the Loop */ ?>
        <?php while ( have_posts() ) : the_post(); ?>
      <?php if ( !$wp_query->current_post > 0 ): ?>
    <?php get_template_part( 'content', get_post_format() ); ?>
    <?php else: ?>
    <div class="post-row col-lg-6 col-md-6 col-sm-6 col-xs-12">
<a href="<?php the_permalink(); ?>" rel="bookmark"><?php if ( the_post_thumbnail('post-thumb') ) { has_post_thumbnail();} ?></a>
<?php the_title( sprintf( '<h1 class="rest-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h1>' ); ?>
    <span class="meta-data"><?php the_time('F jS, Y') ?></span>
    </div>

    <?php endif; ?>

谢谢你的帮助。对不起我的英语。谢谢你

第三个帖子不能放在第一个帖子下面,因为标题的第二行向下推。如果您能为第一行设置一个高度,这应该可以解决您的问题。

请包含您主题中的代码片段。我将其添加到了帖子中。当然,我在开始前端开发时遇到了完全相同的问题。选择我的答案,如果它真的有帮助-
    <?php if ( have_posts() ) : ?>

        <?php /* Start the Loop */ ?>
        <?php while ( have_posts() ) : the_post(); ?>
      <?php if ( !$wp_query->current_post > 0 ): ?>
    <?php get_template_part( 'content', get_post_format() ); ?>
    <?php else: ?>
    <div class="post-row col-lg-6 col-md-6 col-sm-6 col-xs-12">
<a href="<?php the_permalink(); ?>" rel="bookmark"><?php if ( the_post_thumbnail('post-thumb') ) { has_post_thumbnail();} ?></a>
<?php the_title( sprintf( '<h1 class="rest-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h1>' ); ?>
    <span class="meta-data"><?php the_time('F jS, Y') ?></span>
    </div>

    <?php endif; ?>