WC_Template_Loader::unsupported_theme_title_filter( string $title, int $id )

Filter the title and insert WooCommerce content on the shop page.


Description Description

For non-WC themes, this will setup the main shop page to be shortcode based to improve default appearance.


Parameters Parameters

$title

(Required) Existing title.

$id

(Required) ID of the post being filtered.


Top ↑

Return Return

(string)


Top ↑

Source Source

File: includes/class-wc-template-loader.php

	public static function unsupported_theme_title_filter( $title, $id ) {
		if ( self::$theme_support || ! $id !== self::$shop_page_id ) {
			return $title;
		}

		if ( is_page( self::$shop_page_id ) || ( is_home() && 'page' === get_option( 'show_on_front' ) && absint( get_option( 'page_on_front' ) ) === self::$shop_page_id ) ) {
			$args         = self::get_current_shop_view_args();
			$title_suffix = array();

			if ( $args->page > 1 ) {
				/* translators: %d: Page number. */
				$title_suffix[] = sprintf( esc_html__( 'Page %d', 'woocommerce' ), $args->page );
			}

			if ( $title_suffix ) {
				$title = $title . ' – ' . implode( ', ', $title_suffix );
			}
		}
		return $title;
	}

Top ↑

Changelog Changelog

Changelog
Version Description
3.3.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.