任何人都可以嘗試此代碼? 看起來第25行和第44行有一些錯誤。是在home.php中,它提醒我在瀏覽器上只有一個空白頁面。 我不知道PHP,所以我cannota找到什麼問題,你可以幫我嗎?在這個wordpress循環中的錯誤
<?php
if (is_front_page()) {
get_header('front');
} else {
get_header();
}
?>
<section id="content" class="container">
<div class="row">
<div class="col-md-7 col-sm-7">
<?php if (have_posts()) : while (have_posts()) : the_post();
if ($wp_query->current_post === 0) { ?>
<article class="thumbnail thumbnail-principale expand-image">
<div class="featured-image">
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php echo get_the_post_thumbnail($post_id, 'large', array('class' => 'img-responsive')); ?></a>
</div>
<div class="destacado"><h3>Destacado</h3></div>
<header class="testo-articolo">
<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
<div class="entry-meta">
<p class="text-muted resume"><span><i class="fa fa-calendar"></i><?php the_time('j M y'); ?></span><span><i class="glyphicon glyphicon-user"></i><?php the_author(); ?></span><span><i class="fa fa-comment-o"></i><?php comments_popup_link('0', '1 Comentario', '% Comentarios'); ?></span></p>
</div>
<p><?php the_excerpt(); ?></p>
<?php comments_template(); ?><!-- da sistemare -->
</header>
</article>
</div>
<?php
} elseif ($wp_query->current_post >= 1 && $wp_query->current post <= 2) { ?>
<div class="col-md-5 col-sm-5">
<article class="thumbnail thumbnail-destra expand-image">
<div class="featured-image">
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php echo get_the_post_thumbnail($post_id, 'large', array('class' => 'img-responsive')); ?></a>
</div>
<header class="testo-articolo-destra expand-image">
<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
<div class="entry-meta">
<p class="text-muted resume"><span><i class="fa fa-calendar"></i><?php the_time('j M y'); ?></span><span><i class="glyphicon glyphicon-user"></i><?php the_author(); ?></span><span><i class="fa fa-comment-o"></i><?php comments_popup_link('0', '1 Comentario', '% Comentarios'); ?></span></p>
</div>
<p><?php the_excerpt(); ?></p>
</header>
<div class="badge1"></div>
</article>
</div>
<?php
} elseif ($wp_query->current_post >= 3) { ?>
<div class="col-md-4 col-sm-4">
<article class="thumbnail distanza expand-image">
<div class="featured-image">
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php echo get_the_post_thumbnail($post_id, 'large', array('class' => 'img-responsive ingrandire-img')); ?></a>
</div>
<header class="testo-articolo">
<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
<div class="entry-meta">
<p class="text-muted resume"><span><i class="fa fa-calendar"></i><?php the_time('j M y'); ?></span><span><i class="glyphicon glyphicon-user"></i><?php the_author(); ?></span><span><i class="fa fa-comment-o"></i><?php comments_popup_link('Ningún comentario', '1 Comentario', '% Comentarios'); ?></span></p>
</div>
<p><?php the_excerpt(); ?></p>
<p><a class="btn btn-default read-more" href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php _e('Lee más', 'katartika'); ?></a></p>
</header>
</article>
</div>
<?php }
endwhile;
endif; ?>
</div><!-- /row -->
<div style="text-align:center;">
<?php posts_nav_link(‘|’, ‘Prossimo’, ‘Precedente’); ?>
</div>
</section>
</div><!-- /sezione -->
<?php get_footer(); ?>
並啓用[調試](https://codex.wordpress.org/Debugging_in_WordPress)? – d79