WC_Template_Loader::unsupported_theme_product_content_filter( string $content )

Filter the content 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

$content

(Required) Existing post content.


Top ↑

Return Return

(string)


Top ↑

Source Source

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

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

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.