Posts: 876
Name: Matt Pealing
Location: England, north west
|
Thanks for the tips. I've currently got my homepage so that it displays the whole content of the first post, and then excerpts of those that follow, using the following code:
PHP Code:
<?php if(have_posts()) : ?><?php $first_post = ( $paged == 0 ) ? $posts[0]->ID : ''; ?> <?php while(have_posts()) : the_post(); ?> <?php if ($first_post == $post->ID) : ?> <div class="entry"> <div id="h1-wrapper"> <h1><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> <span class="date"><?php the_date(); ?></span></h1> </div> <div class="detail">Filed under <?php the_category(', '); ?>, posted by <a href="#">Matt</a></div> <div class="content"> <?php the_content(); ?> </div> </div> <?php endif; ?> <?php if ($first_post != $post->ID) : ?> <div class="entry"> <div class="h2-wrapper"> <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> <span class="date"><?php the_date(); ?></span></h2> </div> <div class="detail">Filed under <?php the_category(', '); ?>, posted by <a href="#">Matt</a></div> <div class="content"> <?php the_excerpt(); ?> </div> </div> <?php endif; ?> <?php endwhile; ?> <?php endif; ?>
Would it be better to achieve this using query_posts() ? Also, does anyone know how I could show say, 300 characters of the first post instead of all of it, then for the remaining posts to be excerpts of the default length?
|