Submit
Path:
~
/
home
/
getwphos
/
public_html
/
almajd
/
wp-content
/
plugins
/
woocommerce
/
src
/
Blocks
/
Templates
/
File Content:
ProductCatalogTemplate.php
<?php namespace Automattic\WooCommerce\Blocks\Templates; use Automattic\WooCommerce\Blocks\Templates\ArchiveProductTemplatesCompatibility; use Automattic\WooCommerce\Blocks\Utils\BlockTemplateUtils; /** * ProductCatalogTemplate class. * * @internal */ class ProductCatalogTemplate extends AbstractTemplate { /** * The slug of the template. * * @var string */ const SLUG = 'archive-product'; /** * Initialization method. */ public function init() { add_action( 'template_redirect', array( $this, 'render_block_template' ) ); add_filter( 'current_theme_supports-block-templates', array( $this, 'remove_block_template_support_for_shop_page' ) ); } /** * Returns the title of the template. * * @return string */ public function get_template_title() { return _x( 'Product Catalog', 'Template name', 'woocommerce' ); } /** * Returns the description of the template. * * @return string */ public function get_template_description() { return __( 'Displays your products.', 'woocommerce' ); } /** * Renders the default block template from Woo Blocks if no theme templates exist. */ public function render_block_template() { if ( ! is_embed() && ( is_post_type_archive( 'product' ) || is_page( wc_get_page_id( 'shop' ) ) ) && ! is_search() ) { $compatibility_layer = new ArchiveProductTemplatesCompatibility(); $compatibility_layer->init(); $templates = get_block_templates( array( 'slug__in' => array( self::SLUG ) ) ); if ( isset( $templates[0] ) && BlockTemplateUtils::template_has_legacy_template_block( $templates[0] ) ) { add_filter( 'woocommerce_disable_compatibility_layer', '__return_true' ); } add_filter( 'woocommerce_has_block_template', '__return_true', 10, 0 ); } } /** * 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; } }
Submit
FILE
FOLDER
Name
Size
Permission
Action
AbstractPageTemplate.php
1855 bytes
0644
AbstractTemplate.php
596 bytes
0644
AbstractTemplateCompatibility.php
5894 bytes
0644
AbstractTemplatePart.php
332 bytes
0644
ArchiveProductTemplatesCompatibility.php
12726 bytes
0644
CartTemplate.php
2434 bytes
0644
CheckoutHeaderTemplate.php
863 bytes
0644
CheckoutTemplate.php
2477 bytes
0644
ClassicTemplatesCompatibility.php
2430 bytes
0644
ComingSoonSocialLinksTemplate.php
1132 bytes
0644
ComingSoonTemplate.php
2642 bytes
0644
ExternalProductAddToCartWithOptionsTemplate.php
1021 bytes
0644
GroupedProductAddToCartWithOptionsTemplate.php
1016 bytes
0644
MiniCartTemplate.php
1714 bytes
0644
OrderConfirmationTemplate.php
1618 bytes
0644
ProductAttributeTemplate.php
2515 bytes
0644
ProductBrandTemplate.php
1804 bytes
0644
ProductCatalogTemplate.php
2406 bytes
0644
ProductCategoryTemplate.php
1784 bytes
0644
ProductSearchResultsTemplate.php
2158 bytes
0644
ProductTagTemplate.php
1764 bytes
0644
SimpleProductAddToCartWithOptionsTemplate.php
1011 bytes
0644
SingleProductTemplate.php
9477 bytes
0644
SingleProductTemplateCompatibility.php
14601 bytes
0644
VariableProductAddToCartWithOptionsTemplate.php
1021 bytes
0644
N4ST4R_ID | Naxtarrr