<?php if ( have_posts() ) : while ( have_posts() ) : the_post();
$loopcounter++; ?>
<?php if ($loopcounter == 1) { ?>
<section class="post" class="postFeatured">
<h1 class="post"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h1>
<?php } else { ?>
<section class="post" class="postSmall">
<h2 class="post"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
<?php } ?>
<div class="image">
<a href="<?php the_permalink() ?>" title="<?php the_title(); ?>" class="imgHolder">
<div class="img">
<div class="cc"><span class="number"><?php comments_number('0', '1', '%'); ?></span><span class="txt">COMMENTS</span></div>
<?php $image = get_post_meta($post->ID, 'image', true); ?>
<img src="<?php echo $image; ?>" alt="<?php the_permalink() ?>" />
</div>
</a>
</div>
<ul class="postDetail">
<li class="dateAuth">
<div class="dMY"><?php the_time('d M Y') ?></div>
<div class="author">Posted by <?php the_author_posts_link() ?></div>
</li>
<li class="categories">
<div class="cats"><?php the_category(', ') ?></div>
</li>
</ul>
<div class="entry excerpt">
<?php the_excerpt(); ?>
<a href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>" class="read-more">Read Article</a>
</div>
</section>
<?php } endwhile; endif; ?>
不确定原因,有人可以帮助我吗?
REDUCED
<?php if ( have_posts() ) : while ( have_posts() ) : the_post();
$loopcounter++; ?>
<div class="post">
<?php if ($loopcounter == 1) { ?>
<h1 class="first"><?php the_title(); ?></h1>
<?php } else { ?>
<h1 class="second"><?php the_title(); ?></h1>
<?php } ?>
<?php the_content(); ?>
</div>
<?php } endwhile; endif; ?>
错误最终成为:<?php } endwhile; endif; ?>
答案 0 :(得分:3)
失去endwhile
之前的右大括号。
此外,endif
是多余的。
答案 1 :(得分:1)
endwhile之前的最后一个大括号与任何开口花括号都不匹配。