![]() |
wordpress 模板文件的优先级
在编写主题模板时,模板文件是存在优先级差别的。
说明:以下wordpress 最先访问1.,若未发现1则访问2.,若仍未发现2.,则访问3.,依次类推。 一、首页显示次序: 1. home.php 2. index.php 二、单页显示: 1. single.php 2. index.php 二、页面显示: wordpress 页面: 1. pagetemlate.php – “pagetemlate.php”是你特定的页面模板文件. 2. page.php 3. index.php 三、分类显示: 分类模板: 1. category-slug.php – 如果分类的slug(标题)是news,则wordpress将访问category-news. 2. category-id.php -如果分类的ID(编号)是6,则wordpress将访问category-6. wordpress2.3以上版本已经取消ID设置,如果你需要的话,可以在分类URL地址栏中自行添加cat_ID。 3. category.php 4. archive.php 5. index.php (注:category-slug.php目前版本还不支持,将在2.9版支持。) 当无category-slug.php时,wordpress将访问category-id,若仍未发现,现访问category.php,依次类推。 四、标签显示: 1. tag-slug.php -如果标签的slug(标题)是news,则wordpress将访问tag-news. 2. tag-id.php -如果分类的ID(编号)是6,则wordpress将访问category-6. 3. tag.php 4. archive.php 5. index.php (注:tag-id.php 将在2.9版支持) 五、作者显示: 模板文件: 1. author.php 2. archive.php 3. index.php 六、日期显示: 归档(日期)模板: 1. date.php 2. archive.php 3. index.php 七、搜索显示: 创建搜索模板: 1. search.php 2. index.php 八、404(未找到)显示 创建错误404模板: 1. 404.php 2. index.php 九、附加显示 附加模板: 1. MIME_type.php -可以是任意形式的媒体模板(如image.php”图片”,video.php”视频”,audio.php”音频”,application.php”应用程序”等) 2. attachment.php 3. single.php 4. index.php 版本说明: 2.9 支持category-slug.php, tag-id.php 2.? 支持attachment pages 2.3 支持Tag(标签), Pages(页面) |
| All times are GMT +8. The time now is 05:39 AM. |
Powered by vBulletin Version 3.8.7
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.