wordpress
构建你的 WordPress 小工具
创建“构造函数”
在本课程中,你需要在 Tutsplus_List_Pages_Widget 类里面填充你自己建立的__construct() 函数。
打开你的插件文件,并找到“构造函数”。编辑如下:
function __construct() {
parent::__construct(
// 小工具ID
'tutsplus_list_pages_widget',
// 小工具名称
__('List Related Pages', 'tutsplus' ),
// 小工具选项
array (
'description' => __( 'Identifies where the current page is in the site structure and displays a list of pages in the same section of the site. Only works on Pages.', 'tutsplus' )
)
);
}
以上代码定义了创建你的WordPress小工具需要的相关参数。它们分别是:
WordPress小工具的唯一ID
WordPress小工具在其界面上的名称
一系列在WordPress小工具界面显示的选项,包括选项说明。
现在保存你的插件文件。
现在你会发现如果你激活这个插件,在WordPress小工具界面上你的插件就会被显示出来。当然目前为止它仍然不能工作,因为你还没有给它创建表单和任何的输出设置。
在本课程中,你需要在 Tutsplus_List_Pages_Widget 类里面填充你自己建立的__construct() 函数。
打开你的插件文件,并找到“构造函数”。编辑如下:
function __construct() {
parent::__construct(
// 小工具ID
'tutsplus_list_pages_widget',
// 小工具名称
__('List Related Pages', 'tutsplus' ),
// 小工具选项
array (
'description' => __( 'Identifies where the current page is in the site structure and displays a list of pages in the same section of the site. Only works on Pages.', 'tutsplus' )
)
);
}
以上代码定义了创建你的WordPress小工具需要的相关参数。它们分别是:
WordPress小工具的唯一ID
WordPress小工具在其界面上的名称
一系列在WordPress小工具界面显示的选项,包括选项说明。
现在保存你的插件文件。
现在你会发现如果你激活这个插件,在WordPress小工具界面上你的插件就会被显示出来。当然目前为止它仍然不能工作,因为你还没有给它创建表单和任何的输出设置。
Post a Comment
0 Comments