WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

WC_Template_Loader::unsupported_theme_shop_content_filter() public WC 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_shop_content_filter( $content );
$content(строка) (обязательный)
Existing post content.

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

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

Код WC_Template_Loader::unsupported_theme_shop_content_filter() WC 5.7.1

public static function unsupported_theme_shop_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_shop_content_filter' ) );

	// Unsupported theme shop page.
	if ( is_page( self::$shop_page_id ) ) {
		$args      = self::get_current_shop_view_args();
		$shortcode = new WC_Shortcode_Products(
			array_merge(
				WC()->query->get_catalog_ordering_args(),
				array(
					'page'     => $args->page,
					'columns'  => $args->columns,
					'rows'     => $args->rows,
					'orderby'  => '',
					'order'    => '',
					'paginate' => true,
					'cache'    => false,
				)
			),
			'products'
		);

		// Allow queries to run e.g. layered nav.
		add_action( 'pre_get_posts', array( WC()->query, 'product_query' ) );

		$content = $content . $shortcode->get_content();

		// Remove actions and self to avoid nested calls.
		remove_action( 'pre_get_posts', array( WC()->query, 'product_query' ) );
		WC()->query->remove_ordering_args();
	}

	self::$in_content_filter = false;

	return $content;
}