Template Hierarchy
From ThaiiS Note (Wiki)
wordpress 3
wordpress 2.9
Template_Hierarchy home
Home Page display
1. home.php
2. index.php
Contents |
Single Post display
1. single.php
2. index.php
Page display
WordPress Pages:
1. custom template - Where custom template is the Page Template assigned to the Page.
2. page-slug.php - If the page slug is recent-news, WordPress will look to use page-recent-news.php Note: not available until Version 2.9.
3. page-id.php - If the page ID is 6, WordPress will look to use page-6.php Note: not available until Version 2.9.
4. page.php
5. index.php
Category display
Category Templates:
1. category-slug.php - If the category's slug were news, WordPress would look for category-news.php Note: not available until Version 2.9.
2. category-id.php - If the category's ID were 6, WordPress would look for category-6.php
3. category.php
4. archive.php
5. index.php
Tag display
Tag Templates:
1. tag-slug.php - If the tag's slug were sometag, WordPress would look for tag-sometag.php
2. tag-id.php - If the tag's ID were 6, WordPress would look for tag-6.php Note: not available until Version 2.9.
3. tag.php
4. archive.php
5. index.php
Author display
Author Templates:
1. author.php
2. archive.php
3. index.php
Date display
Archive (Date) Templates:
1. date.php
2. archive.php
3. index.php
Search Result display
Creating a Search Page:
1. search.php
2. index.php
404 (Not Found) display
Creating an Error 404 Page:
1. 404.php
2. index.php
Attachment display
Attachment Templates:
1. MIME_type.php - it can be any MIME type (image.php, video.php, audio.php, application.php or any other).
2. attachment.php
3. single.php
4. index.php
wordpress 2.8
Note
- หากต้องการออกแบบเพียงไฟล์เดียวสามารถเขียนทั้งหมดได้บน file index.php
- หากหน้าแรกไม่ต้องการ function ของ wordpress ออกแบบหน้าแรกที่ home.php และ function ที่ สำคัญของ wordpress เก็บไว้ที่ index.php
