WordPressテーマファイル一覧
基本ファイル
| style.css | テーマ情報(Theme Nameなど)とスタイルを記述するメインCSS |
| functions.php | 機能追加・テーマサポート設定・カスタム処理を記述 |
| index.php | すべてのテンプレートの最終フォールバック |
トップページ関連
| front-page.php | サイトのトップページ専用 |
| home.php | ブログ記事一覧(投稿トップ) |
個別ページ
| single.php | 投稿の個別ページ |
| page.php | 固定ページの個別ページ |
| singular.php | 投稿 + 固定ページ共通の個別テンプレート 使う場面:投稿と固定ページのデザインを統一したい時。 |
一覧ページ
| archive.php | アーカイブ全般(カテゴリ・タグ・著者・日付など) |
| category.php | カテゴリーページ |
| tag.php | タグページ |
検索・404
| search.php | 検索結果ページ |
| 404.php | ページが存在しない時のエラーページ |
共通パーツ
| header.php | ヘッダー |
| footer.php | フッター |
| sidebar.php | サイドバー |
部分テンプレート
| content.php | 投稿ループ内の共通出力パーツ ポイント: ・名前は固定ではなく任意 ・ get_template_part('content')と呼ぶために content.phpとするのが一般的使う場面:投稿一覧やループ部分をパーツ化して整理したい時。 |
カスタム投稿タイプ
| single-{post_type}.php | 特定のカスタム投稿タイプの個別ページ |
| archive-{post_type}.php | 特定のカスタム投稿タイプの一覧表示 |
| taxonomy-{taxonomy}.php | カスタムタクソノミーのアーカイブページ |
| taxonomy-{taxonomy}-{term}.php | 特定タクソノミー + 特定ターム専用テンプレート |
テンプレート階層フローチャート
投稿ページ
- single-{post_type}.php
- single.php
- singular.php
- index.php
固定ページ
- page-{slug}.php
- page-{id}.php
- page.php
- singular.php
- index.php
カテゴリーアーカイブ
- category-{slug}.php
- category-{id}.php
- category.php
- archive.php
- index.php
タグアーカイブ
- tag-{slug}.php
- tag-{id}.php
- tag.php
- archive.php
- index.php
カスタム投稿タイプ(アーカイブ)
- archive-{post_type}.php
- archive.php
- index.php
カスタム投稿タイプ(個別ページ)
- single-{post_type}.php
- single.php
- singular.php
- index.php
トップページ
- 固定フロントページ設定あり
- front-page.php
- home.php
- index.php
- 投稿一覧(ブログトップ)
- home.php
- index.php
検索結果
- search.php
- index.php
404
- 404.php
- index.php