トップページに、カテゴリー分けした新着記事を載せたい時などは、index.phpの表示させたいところへ以下のphpを記述します。
<dl>
<?php query_posts('posts_per_page=ここに表示記事数を入れる&order=desc&cat=カテゴリーのIDを入れる'); ?>
<?php while (have_posts()) : the_post(); ?>
<dt>
<?php echo date("Y.m.d", strtotime($post->post_date)); ?>
<dd>
<a href="<?php the_permalink(); ?>" id="post-<?php the_ID(); ?>">
<?php the_title(); ?> </a>
</dd>
<?php endwhile;wp_reset_query(); ?>
</dl>
「ここに表示記事数を入れる」の所に、希望する表示件数を書き込みます。
(例:’posts_per_page=1 )
カテゴリーIDを調べる簡単な方法は、ブラウザで投稿→カテゴリーを開き、登録したカテゴリー名にカーソルを当てるとブラウザの下にURLが出ますので、そのURL内から「&tag_ID=」を見付けてください。
tag_ID= の後に書かれた数字がカテゴリーIDになります。
