追記 下記の方法よりももっと簡単な方法がわかったので記載します
スラッグが jisseki / info / photo などがある場合
それぞれのアーカイブファイル名とすれば表示できました。
category-jisseki.php
category-info.php
category-photo.php
—————————————————————————————
以下元の記事
newsというカテゴリと、postというカテゴリとその他で3つに分ける例にする
1.以下のファイルを作成してアップする
アーカイブページ
category.php
category-1.php
category-2.php
category-3.php
投稿ページ
single.php
single-1.php
single-2.php
single-3.php
2.category.phpの中に以下を書き込む
<?php if (is_category(‘news’)) { // カテゴリA
include(TEMPLATEPATH . ‘/category-1.php’);
} else if (is_category(‘post’)) { // カテゴリB
include(TEMPLATEPATH . ‘/category-2.php’);
} else if (is_category(”)) { // カテゴリC
include(TEMPLATEPATH . ‘/category-3.php’);
}
?>
3.それぞれのカテゴリページをコーディングする
4.single.phpに以下を書き込む
<?php if ( in_category(‘news’) ) { // カテゴリA
include(TEMPLATEPATH . ‘/single-1.php’);
} else if ( in_category(‘post’) ) { // カテゴリB
include(TEMPLATEPATH . ‘/single-2.php’);
} else if ( in_category(”) ) { // カテゴリC
include(TEMPLATEPATH . ‘/single-3.php’);
}
?>
5.それぞれの投稿ページをコーディングする
なおパーマルリンクは
/%category%/%postname% としています
カテゴリ名を日本語にするとうまく動かないことがあったので
スラッグと両方共英語の方がよいかも、、と思います
参考元サイト
ありがとうございました!
Hello there! This post couldn’t be written any better! Looking at this article reminds me of my previous roommate!
He constantly kept preaching about this. I am going to send this post to him.
Fairly certain he will have a very good read. I appreciate you for sharing!