38 lines
1.2 KiB
PHP
38 lines
1.2 KiB
PHP
<?php
|
||
declare(strict_types=1);
|
||
defined('ABSPATH') || exit;
|
||
|
||
/**
|
||
* WooCommerce integration: wrappers, hooks. Keep template overrides minimal.
|
||
*/
|
||
|
||
add_action('after_setup_theme', 'xshop_woo_setup');
|
||
|
||
function xshop_woo_setup(): void {
|
||
if (!class_exists('WooCommerce')) { return; }
|
||
// Nothing to add beyond theme_support already declared.
|
||
// Hook wrappers if WooCommerce is active.
|
||
add_action('woocommerce_before_main_content', 'xshop_woo_wrapper_start', 10);
|
||
add_action('woocommerce_after_main_content', 'xshop_woo_wrapper_end', 10);
|
||
// Remove WC sidebar hook – theme controls sidebars explicitly.
|
||
remove_action('woocommerce_sidebar', 'woocommerce_get_sidebar', 10);
|
||
}
|
||
|
||
function xshop_woo_wrapper_start(): void {
|
||
echo '<main id="primary" class="xshop-main xshop-container"><div class="xshop-woo-layout">';
|
||
}
|
||
|
||
function xshop_woo_wrapper_end(): void {
|
||
echo '</div></main>';
|
||
}
|
||
|
||
add_filter('woocommerce_enqueue_styles', '__return_empty_array');
|
||
|
||
// Notices: ensure they render inside theme container when not using WC wrappers.
|
||
add_action('wp', 'xshop_woo_notice_compat');
|
||
|
||
function xshop_woo_notice_compat(): void {
|
||
if (!class_exists('WooCommerce')) { return; }
|
||
// No-op for M1; placeholder for future notice positioning hooks.
|
||
}
|