2026-02-28 17:55:39 +01:00
|
|
|
<?php
|
|
|
|
|
/**
|
|
|
|
|
* Single Product Page (Bootstrap 5 Layout)
|
|
|
|
|
*
|
|
|
|
|
* Renders the WooCommerce single product content. This file is NOT included
|
|
|
|
|
* directly by WordPress. Instead, it is captured via output buffering by
|
|
|
|
|
* wc_bootstrap_render_single_product() and injected into the parent theme's
|
|
|
|
|
* page shell (pages/page.html.twig). Therefore it does NOT call
|
|
|
|
|
* get_header()/get_footer() or render the wrapper hooks.
|
|
|
|
|
*
|
|
|
|
|
* @package WcBootstrap
|
|
|
|
|
* @since 0.1.0
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
defined( 'ABSPATH' ) || exit;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Hook: woocommerce_before_main_content.
|
|
|
|
|
*
|
|
|
|
|
* @hooked woocommerce_output_content_wrapper - 10 (outputs opening divs for the content)
|
|
|
|
|
* @hooked woocommerce_breadcrumb - 20
|
|
|
|
|
*/
|
|
|
|
|
do_action( 'woocommerce_before_main_content' );
|
|
|
|
|
|
2026-03-29 15:19:53 +02:00
|
|
|
$category_tree = wc_bootstrap_get_category_tree();
|
|
|
|
|
$has_widgets = is_active_sidebar( 'shop-sidebar' );
|
|
|
|
|
$has_sidebar = ! empty( $category_tree ) || $has_widgets;
|
|
|
|
|
|
|
|
|
|
?>
|
|
|
|
|
<div class="row g-4">
|
|
|
|
|
<?php if ( $has_sidebar ) : ?>
|
|
|
|
|
<aside class="col-lg-3 mb-4 mb-lg-0">
|
|
|
|
|
<button class="btn btn-outline-secondary w-100 d-lg-none mb-3"
|
|
|
|
|
type="button"
|
|
|
|
|
data-bs-toggle="offcanvas"
|
|
|
|
|
data-bs-target="#shopSidebar"
|
|
|
|
|
aria-controls="shopSidebar">
|
|
|
|
|
<i class="bi bi-list me-1" aria-hidden="true"></i>
|
|
|
|
|
<?php esc_html_e( 'Categories', 'wc-bootstrap' ); ?>
|
|
|
|
|
</button>
|
|
|
|
|
|
|
|
|
|
<div class="offcanvas-lg offcanvas-start"
|
|
|
|
|
id="shopSidebar"
|
|
|
|
|
tabindex="-1"
|
|
|
|
|
aria-labelledby="shopSidebarLabel">
|
|
|
|
|
<div class="offcanvas-header d-lg-none">
|
|
|
|
|
<h5 class="offcanvas-title" id="shopSidebarLabel">
|
|
|
|
|
<?php esc_html_e( 'Categories', 'wc-bootstrap' ); ?>
|
|
|
|
|
</h5>
|
|
|
|
|
<button type="button" class="btn-close" data-bs-dismiss="offcanvas" aria-label="<?php esc_attr_e( 'Close', 'wc-bootstrap' ); ?>"></button>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="offcanvas-body p-0">
|
|
|
|
|
<?php
|
|
|
|
|
if ( ! empty( $category_tree ) ) {
|
|
|
|
|
$twig = \WPBootstrap\Twig\TwigService::getInstance();
|
|
|
|
|
echo $twig->render( 'global/category-tree.html.twig', [
|
|
|
|
|
'categories' => $category_tree,
|
|
|
|
|
'shop_url' => wc_get_page_permalink( 'shop' ),
|
|
|
|
|
'current_cat' => 0,
|
|
|
|
|
] );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( $has_widgets ) {
|
|
|
|
|
dynamic_sidebar( 'shop-sidebar' );
|
|
|
|
|
}
|
|
|
|
|
?>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</aside>
|
|
|
|
|
<div class="col-lg-9">
|
|
|
|
|
<?php else : ?>
|
|
|
|
|
<div class="col-12">
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
|
|
|
|
|
<?php
|
|
|
|
|
while ( have_posts() ) {
|
|
|
|
|
the_post();
|
|
|
|
|
wc_get_template_part( 'content', 'single-product' );
|
|
|
|
|
}
|
|
|
|
|
?>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<?php
|
2026-02-28 17:55:39 +01:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Hook: woocommerce_after_main_content.
|
|
|
|
|
*
|
|
|
|
|
* @hooked woocommerce_output_content_wrapper_end - 10 (outputs closing divs for the content)
|
|
|
|
|
*/
|
|
|
|
|
do_action( 'woocommerce_after_main_content' );
|