woocommerce_page_title()WC 1.0

Page Title function.

Hooks from the function

Return

String.

Usage

woocommerce_page_title( $echo );
$echo(true|false)
Should echo title.
Default: true

woocommerce_page_title() code WC 9.3.3

function woocommerce_page_title( $echo = true ) {

	if ( is_search() ) {
		/* translators: %s: search query */
		$page_title = sprintf( __( 'Search results: “%s”', 'woocommerce' ), get_search_query() );

		if ( get_query_var( 'paged' ) ) {
			/* translators: %s: page number */
			$page_title .= sprintf( __( ' – Page %s', 'woocommerce' ), get_query_var( 'paged' ) );
		}
	} elseif ( is_tax() ) {

		$page_title = single_term_title( '', false );

	} else {

		$shop_page_id = wc_get_page_id( 'shop' );
		$page_title   = get_the_title( $shop_page_id );

	}

	$page_title = apply_filters( 'woocommerce_page_title', $page_title );

	if ( $echo ) {
		// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
		echo $page_title;
	} else {
		return $page_title;
	}
}