wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren



the_title › WordPress Function

Seit0.71
Veraltetn/v
the_title ( $before = '', $after = '', $display = true )
Parameter: (3)
  • (string) $before Optional. Markup to prepend to the title. Default empty.
    Erforderlich: Nein
    Standard: (leer)
  • (string) $after Optional. Markup to append to the title. Default empty.
    Erforderlich: Nein
    Standard: (leer)
  • (bool) $display Optional. Whether to echo or return the title. Default true for echo.
    Erforderlich: Nein
    Standard: true
Gibt zurück:
  • (void|string) Void if `$display` argument is true or the title is empty, current post title if `$display` is false.
Definiert in:
Codex:

Displays or retrieves the current post title with optional markup.



Quellcode

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

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

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

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