WP HOOKS
filtrod 4.4.0

document_title_parts

Args 1Plik wp-includes/general-template.phpDokumentacja WP ↗

Opis

Modyfikuje części tytułu strony generowanego w <title>.

Przykład użycia

add_filter( 'document_title_parts', ... )php
add_filter( 'document_title_parts', 'wpdocs_title_parts' );

function wpdocs_title_parts( $title ) {
	if ( empty( $title['tagline'] ) ) {
		$title['tagline'] = __( 'Wszystko o WordPressie', 'wpdocs' );
	}

	return $title;
}

Parametry

ParametrTypOpis
$titlearray{ The document title parts. @type string $title Title of the viewed page. @type string $page Optional. Page number if paginated. @type string $tagline Optional. Site description when on home page. @type string $site Optional. Site title when not on home page. }

Wywołanie

Rejestracja callbackaphp
// rejestracja funkcji zwrotnej
add_filter( 'document_title_parts', 'twoja_funkcja' );

function twoja_funkcja($param_1) {
	// Twój kod
}

Popularne w tej kategorii