在文件的开头用上一段说明解释文件的功能。例如,在模板文件中就包含有一段说明,关于显示哪些数据和任何循环或文件其他部分的自定义;在插件文件中添加有关其功能说明。例如,下面的说明是告诉用户模板文件的命名、功能,主题是(@package)的一部分,该主题的版本在@since(in place since (@since))。你应该也为插件文件使用类似的系统。
1
2
3
4
5
6
7
8
/**
* Template Name: sidebar-products.php
*
* The include file used for the sidebar on pages using the single-product.php template. Displays a gallery of product images (omitting the featured image which is displayed in the content).
*
* @package wpptl-theme-framework
* @since version 1.0
*/
/** * Template Name: sidebar-products.php * * The include file used for the sidebar on pages using the single-product.php template. Displays a gallery of product images (omitting the featured image which is displayed in the content). * * @package wpptl-theme-framework * @since version 1.0 */
Creating your own WordPress theme framework
This theme supports the 6th part of this series for wptutsplus.
The theme includes the following template files:
archive.php
index.php
page.php - for static pages
page-full-width.php
archive.php - for archive pages
header.php
sidebar.php
footer.php
loop.php
loop-single.php
loop-page.php
functions.php
The theme supports featured images, menus and widgets and uses them as follows:
Featured images:
These are displayed in the archive and index templates if they are present, using the medium size.
Menus:
The default menu is in header.php, and uses the Menus admin
Styling
The theme uses Object Oriented CSS (OOCSS). The following clases are for layout and you can use them in your pages and posts.
They are responsive, so will resize on smaller screens (for example the .half class is full width on phones)
.full-width
.three-quarters
.two-thirds
.half
.third
.quarter
Hooks
There are 7 action hooks:
Above the header
Inside the header
Before the content
After the content
In the sidebar
In the footer
After the footer
There are 3 filter hooks:
1 in the header
2 in the footer
Widget Areas
There are six widget areas, all added via the widgets.php file:
- one in the header
- one in the sidebar
- four in the footer
Creating your own WordPress theme framework This theme supports the 6th part of this series for wptutsplus. The theme includes the following template files: archive.php index.php page.php - for static pages page-full-width.php archive.php - for archive pages header.php sidebar.php footer.php loop.php loop-single.php loop-page.php functions.php The theme supports featured images, menus and widgets and uses them as follows: Featured images: These are displayed in the archive and index templates if they are present, using the medium size. Menus: The default menu is in header.php, and uses the Menus admin Styling The theme uses Object Oriented CSS (OOCSS). The following clases are for layout and you can use them in your pages and posts. They are responsive, so will resize on smaller screens (for example the .half class is full width on phones) .full-width .three-quarters .two-thirds .half .third .quarter Hooks There are 7 action hooks: Above the header Inside the header Before the content After the content In the sidebar In the footer After the footer There are 3 filter hooks: 1 in the header 2 in the footer Widget Areas There are six widget areas, all added via the widgets.php file: - one in the header - one in the sidebar - four in the footer