home.phpに最新記事指定件数を表示する

home.phpの改造。
現在使用しているhome.phpはどうも全部出すっぽくね?ということでちょこっと改造。

<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<h4 class="storytitle" id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h3>
<?php comments_template(); // Get wp-comments.php template ?>
<?php endwhile; else: ?>
<?php endif; ?>

<?php $posts = get_posts('numberposts=5'); ?>
<?php foreach ($posts as $post): setup_postdata($post); ?>
<h4 class="storytitle" id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h3>
<?php endforeach; ?>

に変更。多分これで大丈夫。
件数を変更するには、get_post('numberposts=5')を変更する。