官方詳細信息:查看
參考:Wordpress大學-插件開發教程
我要開發的是一款能在文本編輯器中添加按鈕的插件,取名為:Magic Button
我谷歌了一下并在Wordpress后臺查找次名字,沒有重名。
我在桌面新建文件夾,取名Magic Button,
目錄結構:
- /Magic Button?— 唯一的插件名稱,不要包含空格或者特殊字符
- Magic Button.php?— 唯一的插件名稱,插件主文件
- uninstall.php?— 插件的卸載文件
- /js?— JavaScript 文件
- /css?— css 樣式表
- /images?— 圖片
- /includes?— 存放要包含的 PHP 文件
在Magic Button.php里面寫入:標準插件信息
<?php
/*
Plugin Name: 插件名稱
Plugin URI: http://URI_Of_Page_Describing_Plugin_and_Updates
Description: 插件的簡單描述
Version: 插件版本號, 例如: 1.0
Author: 插件作者
Author URI: http://URI_Of_The_Plugin_Author作者地址
*/
?>
標準信息頭至少要包括插件名稱,這樣WordPress才能識別你的插件。其他信息將顯示在控制面板插件管理頁面中。標準插件信息對各行順序沒有要求。
版權信息 :寫入GPL版權信息
<?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許可具有“傳染性”,我非常喜歡。
此時,插件已經可以使用了,將Magic Button.php文件放入wp-content/plugin目錄,即可使用。
WordPress代碼編輯標準:查看