WordPress插件开发笔记(一):主文件申明

这是我开发插件LaTeX2HTML的学习笔记.

首先, 一个标准的插件, 至少需要以下

  • 唯一的插件名字: latex2html
  • 以插件名命名的文件夹: latex2html
  • 以插件名命名的主文件: latex2html/latex2html.php

此外, 还有一些文件, 我们将在后续讲解:

  • 说明文件: readme.txt
  • css+js文件夹: css, js
  • includes文件夹方便管理插件的各个部分: latex2html/includes
  • 国际化语言文件夹: latex2html/languages

下面, 我们就开始编辑主文件latex2html/latex2html.php, 主文件应该首先申明插件的基本信息:

amsart as documentclass, to HTML+MathJax.
Version:     1.2.4
Author:      Van Abel
Author URI:  https://vanabel.cn
Text Domain: val2h
Domain Path: /languages
License:     GPL2
 
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
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, see https://www.gnu.org/licenses/gpl-2.0.html.
*/

现在, 如果你将latex2html文件夹放到WP的wp-content/plugins目录下, 则可在WP的插件页看到我们的新插件.

WordPress插件开发笔记(一):主文件申明_第1张图片
LaTeX2HTML Preview

附注: 我是使用 usbwebserver 来搭建本地WP环境的. 安装后只需将WP压缩包解压到usbwebserver的root目录. 然后访问http://localhost:8080/wordpress即可安装WP.

你可能感兴趣的:(WordPress插件开发笔记(一):主文件申明)