WordPress模板基本文件

style.css 样式表文件

index.php 主页文件

single.php 日志单页文件

page.php 页面文件

archvie.php 分类和日期存档页文件

searchform.php 搜索表单文件

search.php 搜索页面文件

comments.php 留言区域文件(包括留言列表和留言框)

404.php 404错误页面

header.php 网页头部文件

sidebar.php 网页侧边栏文件

footer.php 网页底部文件

  1. style.css

    /*
    Theme Name: utubon.com

    Theme URI:

    Description: wordpress

    Author: wordpress

    Version: 1.0

    License:

    License URI:

    Tags: wordpress

    */


  2. function.php
  3. index.php

模板文件之间的调用

wordpress使用模板通过函数的调用,让模板之间形成完整的整体,例如在index.php中你会看到get_header()即调用文件名为header.php的模板文件, get_footer()亦然。get_template_part( 'loop', 'index' );则是调用模板loop-index.php。wordpress并非傻瓜的像include()函数一样包含这些文件,而是对文件的存在与否要进行判断,如果不存在该文件将用对应的相关文件代替,这需要你查看开发文档中该函数的具体解释。

 

文件名一般作用对应的函数备注
style.css 样式表 <?php bloginfo( 'stylesheet_url' ); ?>调用地址  
index.php wp识别首页 自动识别  
functions.php 包含增函数和新功能 自动识别  
header.php 头部 get_header()  
footer.php 尾部 get_footer  
sidebar.php 边侧栏 get_sidebar('foot')(无参数则调用sidebar.php) 参数foot指文件sidebar-foot.php类推
loop.php
content.php
内容循环 get_template_part( 'loop', 'index' )和sidebar一样  参数的意思是调用模板loop-index.php类推如果get_template_part( 'content','single' );
404.php
search.php
single.php
分别是404页,搜索页,单独页面,文章内容页 自动识别,和index.php一样,使用上述函数,没有该文件的话用index.php  
archive.php
category.php
tag.php
arthor.php
分别是归档页,分类页,标签页,作者页 同上,但如果只有archive.php或category.php没有其他页,其他页用archive.php代替或category.php代替  
posted on 2017-03-15 19:22  畅行意林  阅读(218)  评论(0编辑  收藏  举报