WC_Template_Loader::unsupported_theme_product_content_filter()public staticWC 3.3.0

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

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

Метод класса: WC_Template_Loader{}

Хуков нет.

Возвращает

Строку.

Использование

$result = WC_Template_Loader::unsupported_theme_product_content_filter( $content );
$content(строка) (обязательный)
Existing post content.

Список изменений

С версии 3.3.0 Введена.

Код WC_Template_Loader::unsupported_theme_product_content_filter() WC 9.4.2

public static function unsupported_theme_product_content_filter( $content ) {
	global $wp_query;

	if ( self::$theme_support || ! is_main_query() || ! in_the_loop() ) {
		return $content;
	}

	self::$in_content_filter = true;

	// Remove the filter we're in to avoid nested calls.
	remove_filter( 'the_content', array( __CLASS__, 'unsupported_theme_product_content_filter' ) );

	if ( is_product() ) {
		$content = do_shortcode( '[product_page id="' . get_the_ID() . '" show_title=0 status="any"]' );
	}

	self::$in_content_filter = false;

	return $content;
}