WordPress网站定制开发专家
WordPress企业主题特惠

赞一个 0

当wordpress载入页面/内容时,它会查找你的主题文件夹并根据命名载入正确的模板页面,Wordpress调用不用的页面/内容,wordpress的查找顺序如下:

  • 404
    1. 404.php
    2. index.php
  • Search
    1. search.php
    2. index.php
  • Tax
    1. taxonomy-{tax}-{term}.php
    2. taxonomy-{tax}.php
    3. taxonomy.php
    4. archive.php
    5. index.php
  • Home
    1. home.php
    2. index.php
  • Attachment
    1. mime.php
    2. type.php
    3. mime_type.php
    4. attachment.php
    5. single.php
    6. index.php
  • Single
    1. single-{post-type}.php
    2. single.php
    3. index.php
  • Page
    1. custom_template.php
    2. page-{slug}.php
    3. page-{id}.php
    4. page.php
    5. index.php
  • Category
    1. category-{slug}.php
    2. category-{id}.php
    3. category.php
    4. archive.php
    5. index.php
  • Tag
    1. tag-{slug}.php
    2. tag-{id}.php
    3. tag.php
    4. archive.php
    5. index.php
  • Author
    1. author-{author-nicename}.php
    2. author-{author-id}.php
    3. author.php
    4. archive.php
    5. index.php
  • Date
    1. date.php
    2. archive.php
    3. index.php
  • Archive
    1. archive.php
    2. index.php

点击这里查看大图

WordPress

WordPress页面/内容函数对应的模板,WordPress加载模板的机制如下图:

点击这里查看大图

WordPress

上一篇:

下一篇:

在线评论

4 个评论

  1. 说得很好,又学到新知识了,谢谢。。。。

  2. 有空常来看看我的博客。

分页
在线客服
在线客服关闭
WPYOU官方微信

扫码关注官方微信