0
我需要更改此代碼,以便第一篇文章以「first」類顯示,並且firsttop和firstbottom也有firsttop類。內頁的其餘部分,例如page/2 /,page/3 /等將不會有這個類。我已經嘗試了很多事情,請幫助不知道這裏有什麼錯。在主頁上的自定義第一篇wordpress
<?php
if (have_posts()) :
$count = 0;
while (have_posts()):
the_post();
if (get_post_type() == 'post'):
?>
<?php
if (!is_single() && $count == 0):
?>
<div class="firsttop<?php echo !is_home() ? "notop" : "" ?>"></div>
<?php endif; ?>
<article class="post <?php echo !is_single() ? "preview" : "" ?> <?php echo $count == 0 ? "first" : "" ?> <?php echo !is_home() ? "full" : "" ?>">
<p class="byline">
<?php the_time('F j, Y'); ?>
</p>
<h3>
<a href="<?php echo get_permalink() ?>"><?php the_title(); ?> </a>
</h3>
<div>
<?php the_content('<span class="more">Read More...</span>'); ?>
</div>
<?php include ('post-info.php'); ?>
</article>
<?php
if (!is_single() && $count == 0):
?>
<div class="firstbottom<?php echo !is_home() ? "nobottom" : "" ?>"></div>
<?php endif; ?>
<?php
endif;
$count++;
endwhile;
endif;
?>