简单说,就是如果一个.php文件放在.wp-content/plugins/目录下,或者之下的子目录下,比如,.wp-content/plugins/yourplugin,打开WordPress,WordPress就会检查其中的.php文件是否存在Writing a Plugin说到的信息文件,如下:
<?php
/*
Plugin Name: Name Of The Plugin
Plugin URI: http://URI_Of_Page_Describing_Plugin_and_Updates
Description: A brief description of the Plugin.
Version: The Plugin's Version Number, e.g.: 1.0
Author: Name Of The Plugin Author
Author URI: http://URI_Of_The_Plugin_Author
License: A "Slug" license name e.g. GPL2
*/
?>
如果存在,就会收录,把它显示在控制面板的plugins下,打开plugins,点击其下的activate,如果写的合格即可激活。
写plugin很简单,写一个函数,然后用add_action(‘WordPress action’,‘plugin函数名’);把它添加到WordPress上。就是调用“WordPress action”时,这个函数就会运行。