wp plugin -2
Sanity practices:
(1)命名前缀。plugin范围内,变量、函数名、文件名加一个唯一前缀。
(2)文件组织。至少应该有两个文件:主要的php文件和一个uninstall.php。主要的php可以细分为更多的小文件,便于update和性能。
(3)目录结构。example:
primary.php
uninstall.php
/js
/css
/includes
/images
Header:
< ?php
/*
Plugin Name: My Plugin
Plugin URI: http://example.com/wordpress-plugins/my-plugin
Description: A brief description of my plugin
Version: 1.0
Author: Brad Williams
Author URI: http://example.com
License: GPLv2
*/
? >
License:
< ?php
/* Copyright YEAR PLUGIN_AUTHOR_NAME (email : PLUGIN AUTHOR 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
*/
? >
浙公网安备 33010602011771号