我已經成立了一個WordPress的模板,以顯示完整的第一篇文章,其餘爲摘錄:http://growthgroup.com/testing-blogWordPress的:第一篇文章中滿,另一些則摘錄
當你去到第2頁的帖子,它顯示第一篇文章全部,其他人也作爲摘錄,但我只希望最近發佈的文章是全文,所有其他文章是節選。
有沒有辦法解決這個問題?這裏是我使用的代碼:
<?php
// query to set the posts per page to 5
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args = array('posts_per_page' => 5, 'paged' => $paged);
query_posts($args); ?>
<?php if (have_posts()) : ?>
<?php $postcount = 0; // Initialize the post counter ?>
<?php while (have_posts()) : the_post(); //start the loop ?>
<?php $postcount++; //add 1 to the post counter ?>
<?php if ($postcount == 1) : // if this is the first post ?>
<div class="post">
<h3 class="post-title"><a href="<?php the_permalink();?>" title="<?php the_title();?>"><?php the_title(); ?></a></h3>
<span class="author-date-blog"><?php the_author();?> | <?php the_date('d M Y');?></span>
<div class="excerpt">
<?php the_content();?>
<div class="read-more">
<a href="<?php the_permalink();?>#disqus_thread">Leave a Comment >></a>
</div>
</div>
</div>
<?php else : //if this is NOT the first post ?>
<div class="post">
<div class="thumb">
<a href="<?php the_permalink();?>" title="<?php the_title();?>"><?php the_post_thumbnail('blog-thumb');?></a>
</div>
<h3 class="post-title"><a href="<?php the_permalink();?>" title="<?php the_title();?>"><?php the_title(); ?></a></h3>
<span class="author-date-blog"><?php the_author();?> | <?php the_date('d M Y');?></span>
<div class="excerpt">
<?php the_excerpt(); ?>
<div class="read-more">
<a href="<?php the_permalink();?>">Read More >></a>
</div>
</div>
</div>
<?php endif; endwhile; //end of the check for first post - other posts?>
完美 - 謝謝! – rossautomatica