WP_Theme::display() WordPress Method

The WP_Theme::display() method is used to display a theme. A theme can be displayed in several ways, including as a template in a WordPress template hierarchy, as a template in a WordPress theme, or as a WordPress widget.

WP_Theme::display( string $header, bool $markup = true, bool $translate = true ) #

Gets a theme header, formatted and translated for display.


Parameters

$header

(string)(Required)Theme header. Name, Description, Author, Version, ThemeURI, AuthorURI, Status, Tags.

$markup

(bool)(Optional) Whether to mark up the header. Defaults to true.

Default value: true

$translate

(bool)(Optional) Whether to translate the header. Defaults to true.

Default value: true


Top ↑

Return

(string|array|false) Processed header. An array for Tags if $markup is false, string otherwise. False on failure.


Top ↑

Source

File: wp-includes/class-wp-theme.php

	public function display( $header, $markup = true, $translate = true ) {
		$value = $this->get( $header );
		if ( false === $value ) {
			return false;
		}

		if ( $translate && ( empty( $value ) || ! $this->load_textdomain() ) ) {
			$translate = false;
		}

		if ( $translate ) {
			$value = $this->translate_header( $header, $value );
		}

		if ( $markup ) {
			$value = $this->markup_header( $header, $value, $translate );
		}

		return $value;
	}


Top ↑

Changelog

Changelog
VersionDescription
3.4.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.