filtrod 4.4.0
document_title_parts
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;
}
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
| Parametr | Typ | Opis |
|---|---|---|
$title | array | { 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
}
// rejestracja funkcji zwrotnej
add_filter( 'document_title_parts', 'twoja_funkcja' );
function twoja_funkcja($param_1) {
// Twój kod
}Popularne w tej kategorii