官方詳細(xì)信息:查看
參考:Wordpress大學(xué)-插件開發(fā)教程
我要開發(fā)的是一款能在文本編輯器中添加按鈕的插件,取名為:Magic Button
我谷歌了一下并在Wordpress后臺(tái)查找次名字,沒有重名。
我在桌面新建文件夾,取名Magic Button,
目錄結(jié)構(gòu):
- /Magic Button?— 唯一的插件名稱,不要包含空格或者特殊字符
- Magic Button.php?— 唯一的插件名稱,插件主文件
- uninstall.php?— 插件的卸載文件
- /js?— JavaScript 文件
- /css?— css 樣式表
- /images?— 圖片
- /includes?— 存放要包含的 PHP 文件
在Magic Button.php里面寫入:標(biāo)準(zhǔn)插件信息
<?php
/*
Plugin Name: 插件名稱
Plugin URI: http://URI_Of_Page_Describing_Plugin_and_Updates
Description: 插件的簡(jiǎn)單描述
Version: 插件版本號(hào), 例如: 1.0
Author: 插件作者
Author URI: http://URI_Of_The_Plugin_Author作者地址
*/
?>
標(biāo)準(zhǔn)信息頭至少要包括插件名稱,這樣WordPress才能識(shí)別你的插件。其他信息將顯示在控制面板插件管理頁(yè)面中。標(biāo)準(zhǔn)插件信息對(duì)各行順序沒有要求。
版權(quán)信息 :寫入GPL版權(quán)信息
<?php
/* Copyright 年份 作者名 (email?: 你的郵箱)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
?>
GPL許可具有“傳染性”,我非常喜歡。
此時(shí),插件已經(jīng)可以使用了,將Magic Button.php文件放入wp-content/plugin目錄,即可使用。
WordPress代碼編輯標(biāo)準(zhǔn):查看