Wordpress——学习笔记(1)

插件位置:

/wp-content/plugins/

主文件开始位置加入:

<?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作者地址
*/
?>

 如果使用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
*/
?>

 目录结构(参考):

  • /unique-plugin-name — 唯一的插件名称,不要包含空格或者特殊字符
    • unique-plugin-name.php — 唯一的插件名称,插件主文件
    • uninstall.php — 插件的卸载文件
    • /js — JavaScript 文件
    • /css — css 样式表
    • /images — 图片
    • /includes — 存放要包含的 PHP 文件

 URL路径:

  • plugins_url() — 插件目录的 URL (例如:http://example.com/wp-content/plugins)
  • include_url() — includes 目录的 URL (例如:http://example.com/wp-includes)
  • content_url() — content 目录的 URL (例如:http://example.com/wp-content)
  • admin_url() — admin 目录的 URL (例如:http://example.com/wp-admin/)
  • site_url() — 当前网站的 URL (例如:http://example.com)
  • home_url() — 当前网站首页的 URL (例如:http://example.com)

 

posted @ 2013-08-05 17:45  二分之一黑与白  阅读(184)  评论(0)    收藏  举报