Shop page: Remove the Template panel from the Setting Sidebar (https://github.com/woocommerce/woocommerce-blocks/pull/6366)
This commit is contained in:
parent
217c822b76
commit
26fbb3f569
|
@ -51,6 +51,7 @@ class BlockTemplatesController {
|
|||
add_action( 'template_redirect', array( $this, 'render_block_template' ) );
|
||||
add_filter( 'pre_get_block_file_template', array( $this, 'get_block_file_template' ), 10, 3 );
|
||||
add_filter( 'get_block_templates', array( $this, 'add_block_templates' ), 10, 3 );
|
||||
add_filter( 'current_theme_supports-block-templates', array( $this, 'remove_block_template_support_for_shop_page' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -360,4 +361,30 @@ class BlockTemplatesController {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the template panel from the Sidebar of the Shop page because
|
||||
* the Site Editor handles it.
|
||||
*
|
||||
* @see https://github.com/woocommerce/woocommerce-gutenberg-products-block/issues/6278
|
||||
*
|
||||
* @param bool $is_support Whether the active theme supports block templates.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function remove_block_template_support_for_shop_page( $is_support ) {
|
||||
global $pagenow, $post;
|
||||
|
||||
if (
|
||||
is_admin() &&
|
||||
'post.php' === $pagenow &&
|
||||
function_exists( 'wc_get_page_id' ) &&
|
||||
is_a( $post, 'WP_Post' ) &&
|
||||
wc_get_page_id( 'shop' ) === $post->ID
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $is_support;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue