wpseek.com
Bazujące na WordPress narzędzie wyszukiwania dla deweloperów i twórców motywów.



the_title › WordPress Function

Od0.71
Przestarzałyn/a
› the_title ( $before = '', $after = '', $display = true )
Parametry: (3)
  • (string) $before Optional. Markup to prepend to the title. Default empty.
    Wymagane: Nie
    Domyślny: (puste)
  • (string) $after Optional. Markup to append to the title. Default empty.
    Wymagane: Nie
    Domyślny: (puste)
  • (bool) $display Optional. Whether to echo or return the title. Default true for echo.
    Wymagane: Nie
    Domyślny: true
Powrót:
  • (string|null|void) Current post title when `$display` is false, null when the
    title is empty. Nothing otherwise.
Zdefiniowane na:
Codex:

Displays or retrieves the current post title with optional markup.



Źródło

function the_title( $before = '', $after = '', $display = true ) {
	$title = get_the_title();

	if ( strlen( $title ) === 0 ) {
		return null;
	}

	$title = $before . $title . $after;

	if ( $display ) {
		echo $title;
	} else {
		return $title;
	}
}