美文网首页
WordPress插件开发笔记(一):主文件申明

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

作者: 破旧的大卡车 | 来源:发表于2018-10-27 19:28 被阅读19次

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

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

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

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

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

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

<?php
/*
Plugin Name: LaTeX2HTML
Plugin URI:  https://latex2html.vanabel.cn
Description: Translate your LaTeX doc, mainly with <em>amsart</em> 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的插件页看到我们的新插件.

LaTeX2HTML Preview

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

相关文章

网友评论

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

      本文链接:https://www.haomeiwen.com/subject/dcadtqtx.html