wpseek.com
Uma área de pesquisa sobre o WordPress para devs e autores do tema



the_title › WordPress Function

Desde0.71
Obsoleton/a
the_title ( $before = '', $after = '', $display = true )
Parâmetros: (3)
  • (string) $before Optional. Markup to prepend to the title. Default empty.
    Required: No
    Padrão: (empty)
  • (string) $after Optional. Markup to append to the title. Default empty.
    Required: No
    Padrão: (empty)
  • (bool) $display Optional. Whether to echo or return the title. Default true for echo.
    Required: No
    Padrão: true
Retorna:
  • (void|string) Void if `$display` argument is true or the title is empty, current post title if `$display` is false.
Definido em:
Codex:

Displays or retrieves the current post title with optional markup.



Fonte

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;
	}
}