Читать книгу Professional WordPress Plugin Development - Brad Williams - Страница 43
Creating the Header
ОглавлениеThe plugin header is nothing more than a normal PHP inline code comment with some special formatting that WordPress can recognize. The following is an example of a plugin header:
<?php /** * Plugin Name: My Plugin * Plugin URI: https://example.com/plugins/pdev * Description: A short description of the plugin. * Version: 1.0.0 * Requires at least: 5.3 * Requires PHP: 5.6 * Author: John Doe * Author URI: https://example.com * License: GPL v2 or later * License URI: https://www.gnu.org/licenses/gpl-2.0.html * Text Domain: pdev * Domain Path: /public/lang */
Each line is called a header file and provides some info to WordPress about your plugin. The only required field for the plugin to work is the Plugin Name
field. Each field should be straightforward to understand. The following is a brief description of what each field sets:
Plugin Name: The name for your plugin
Plugin URI: A URI with more information about your plugin
Description: A brief summary that describes what your plugin does
Version: The current version of your plugin, which should be incremented with each update
Requires at least: The minimum version of WordPress required for your plugin to work
Requires PHP: The minimum version of PHP required for your plugin to work
Author: Your or your team/business name
Author URI: The link to your website
License: The license that the plugin is distributed under
License URI: A link to the full text of the license
Text Domain: The text domain used for internationalizing your plugin (see Chapter 11 for more information)
Domain Path: The relative path to where translation files are located in your plugin
Network: An optional field that can be set to true for plugins that can only be activated across the entire network on a multisite installation