記事を取得する関数はありますが、標準だとカテゴリIDは取得されてこないので、 以下のようにすると、カテゴリIDを取得でき、カテゴリに合わせた出力ができます。 カテゴリに合わせた見出しを設定したいときなどに便利です。 <?php if(have_posts()):while(have_posts()): the_post(); ?> <?php foreach((get_the_category()) as $cat){ //カテゴリを取得 $cat_id = $cat->category_parent; if($cat_id == 0){ $cat_id = $cat->cat_ID; } } ?> <?php endwhile; endif; ?> <div id="navi"> <ul> <li class="home"><a href="#">ホーム</a></li> <li><a