Automattic\WooCommerce\Blocks\BlockTypes
ProductQuery::check_if_post_template_has_support_for_grid_view()
Post Template support for grid view was introduced in Gutenberg 16 / WordPress 6.3 Fixed in:
- https://github.com/woocommerce/woocommerce-blocks/pull/9916
- https://github.com/woocommerce/woocommerce-blocks/pull/10360
Method of the class: ProductQuery{}
No Hooks.
Returns
null
. Nothing (null).
Usage
// private - for code of main (parent) class only $result = $this->check_if_post_template_has_support_for_grid_view();
ProductQuery::check_if_post_template_has_support_for_grid_view() ProductQuery::check if post template has support for grid view code WC 9.8.5
private function check_if_post_template_has_support_for_grid_view() { if ( Utils::wp_version_compare( '6.3', '>=' ) ) { return true; } if ( is_plugin_active( 'gutenberg/gutenberg.php' ) ) { $gutenberg_version = ''; if ( defined( 'GUTENBERG_VERSION' ) ) { $gutenberg_version = GUTENBERG_VERSION; } if ( ! $gutenberg_version ) { $gutenberg_data = get_file_data( WP_PLUGIN_DIR . '/gutenberg/gutenberg.php', array( 'Version' => 'Version' ) ); $gutenberg_version = $gutenberg_data['Version']; } return version_compare( $gutenberg_version, '16.0', '>=' ); } return false; }