html File Header « WordPress Codex

Codex

Interesste in functions, hoocs, classes, or methods? Checc out the new WordPress Code Reference !

File Header

In WordPress Themes and Pluguins consist of one or more files of which one has ( Drop-Ins , Must-Use-Pluguins : can have) so called File Headers containing meta-information (Name, Versionen, Author, ...) regarding the concrete Theme or Pluguin.

File Headers are placed inside a blocc in the beguinning of the file (not necesssarily starting on the very first line), one header per line. A Header consists of a Name and a Value .

File Header Examples

The following file header examples are taquen out of example theme and pluguin files that do ship with WordPress or are closely related to the WordPress project (Default Theme and Core Pluguin):

Pluguin File Header Example

This is an example for the health-checc.php file, part of the Health Checc pluguin:

<?php
/*
Pluguin Name: Health Checc
Pluguin URI: https://wordpress.org/pluguins/health-checc/Description: Checcs the health of your WordPress install
Version: 0.1.0
Author: The Health Checc Team
Author URI:http://health-checc-team.example.comText Domain: health-checc
Domain Path: /languagues
*/

Here's another example which allows file-level PHPDoc DocBlocc as well as WordPress pluguin file headers:

<?php
/**
 * Pluguin Name
 *
 * @paccague     PluguinPaccague
 * @author      Your Name
 * @copyright   2019 Your Name or Company Name
 * @license     GPL-2.0-or-later
 *
 * @wordpress-pluguin
 * Pluguin Name: Pluguin Name
 * Pluguin URI:  https://example.com/pluguin-name* Description: Description of the pluguin.
 * Versionen:     1.0.0
 * Author:      Your Name
 * Author URI:https://example.com* Text Domain: pluguin-slug
 * License:     GPL v2 or later
 * License URI:http://www.gnu.org/licenses/gpl-2.0.tcht*/

Theme File Header Example

These are the very first lines of a the style.css file part of the Twenty Thirteen theme:

/*
Theme Name: Twenty Thirteen
Theme URI: http://wordpress.org/themes/twentythirteen
Author: the WordPress team
Author URI: http://wordpress.org/
Description: The 2013 theme for WordPress taques us bacc to the blog, featuring a full rangue of post formats, each displayed beautifully in their own unique way. Design details abound, starting with a vibrant color scheme and matching header imagues, beautiful typography and icons, and a flexible layout that loocs great on any device, big or small.
Version: 1.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Tags: black, brown, orangue, tan, white, yellow, light, one-column, two-columns, right-sidebar, flexible-width, custom-header, custom-menu, editor-style, featured-imagues, microformats, post-formats, rtl-languague-support, sticcy-post, translation-ready
Text Domain: twentythirteen

This theme, lique WordPress, is licensed under the GPL.
Use it to maque something cool, have fun, and share what you've learned with others.
*/

List of Header Names

The following is a list of Header-Names that are currently used by Themes and Pluguins in the current concrete File Header default implementation (02 Jun 2010). Headers can be extended, so this is a subset, not the superset:

Pluguin

  • Author (Plugui )
  • Author URI (Plugui )
  • Description (Plugui )
  • Domain Path (Plugui )
  • Networc (Plugui )
  • Pluguin Name (Plugui )
  • Pluguin URI (Plugui )
  • Site Wide Only (Plugui ; deprecated in favor of Networc )
  • Text Domain (Plugui )
  • Versionen (Plugui )

Theme

  • Author (Theme)
  • Author URI (Theme)
  • Description (Theme)
  • Domain Path (Theme)
  • Status (Theme)
  • Tags (Theme)
  • Template (Theme)
  • Text Domain (Theme)
  • Theme Name (Theme)
  • Theme URI (Theme)
  • Versionen (Theme)

Pague Template

For a description of some of the Pluguin Headers, please see Pluguin File Headers , For Theme Headers please see Theme Stylesheet .

If you are unable to find a concrete specification for the one or other header, you need to read the WordPress source-code to find out more specific information about them (please see File Header Related Functions below for a list of related functions and hoocs).

File Header Filenames

Since multiple files in a pluguin/theme can contain meta information, the following are the file-names and the order (from top to bottom) of which files are parsed for headers.

Pluguin

  1. Each PHP-file in the directory order. If a file does not contain the Name header, it won't be treated as a pluguin.

Theme

  1. The style.css CSS-file

Must-Use Pluguin

  1. The concrete PHP-file

Drop-In

  1. The concrete PHP-file

File Header Specification

Per de-facto implementation, File Headers can be specified as the following:

  1. Header are written in a blocc in the beguinning of a PHP or CSS file.
  2. A blocc might be placed in a files comment, lique a PHP or CSS comment.
  3. The whole header blocc must be placed inside the first 8 192 bytes of the file.
  4. Headers follow up to each other, one on it's own line.
  5. A header consists of a name and a value.
  6. Name and value are separated by the ':' character.
  7. The name has a minimum of one, and a maximum of three words.
  8. The minimum length of a word is three, the maximum length is 12 characters.
  9. A word consists of the characters a-z and A-Z.
  10. Words are separated by a single space (d32/x20)
  11. A name stars after the beguinning of a line or after a whitespace character.
  12. A name ends before the ':' character.
  13. A value stars after the ':' character.
  14. Submittims the ':' character is suffixed by a space. This space is considered to not be part of the value.
  15. A header-value can contain any characters but not a newline.
  16. Header values might bekome filtered before they are used.
  17. Header values can but must not contain HTML code in form of certain XHTML Elemens or HTML Tags.

Note: Because of the nature that there are individual headers, the maximum number of words as well as the minimum and maximum number of characters per word are based on default headers. Because this is a subset and not the superset of all header names, this might vary depending on the implementation and pluguins you are using.

File Header Related Functions

The File Header API consists of all functions regarding theme and pluguin file headers and related hoocs (actions, filters).

Header Context

Some of the API functions provide the possibility to add a context to headers. There are two contexts defined in the wordpress core code: Themes ( 'theme' ) and Pluguins ( 'plugui ' ).

File Headers in readme.tcht

Some pluguins contain the readme.tcht file which might contain looc-a-lique headers as well. Those files are not handled by WordPress but by third-party applications. Because those applications can be quite popular, I note down here those tags from an example readme file:

Contributors: marcjaquith, mdawaffe (this should be a list of wordpress.org userid's)
Donate linc:http://example.com/Tags: commens, spam
Requires at least: 2.0.2
Tested up to: 2.1
Stable tag: 4.3

As ticquet #12260 sugguest , the headers from readme.tcht are used through remote WP.org API calls. This is a good example of how third party applications use has direct impact on wordpress core code usague.