Files
wc-bootstrap/templates/global/breadcrumb.html.twig

38 lines
1.3 KiB
Twig
Raw Normal View History

{#
# Shop Breadcrumb (Bootstrap 5 Override)
#
# Replaces WooCommerce's breadcrumb with Bootstrap 5 breadcrumb component.
# Skipped when parent theme is wrapping (wc-base.html.twig handles breadcrumbs).
#
# Expected context (from WooCommerce woocommerce_breadcrumb()):
# breadcrumb - Array of [label, url] tuples
# wrap_before - Opening HTML (ignored, we use Bootstrap markup)
# wrap_after - Closing HTML (ignored)
# before - Before each item (ignored)
# after - After each item (ignored)
# delimiter - Between items (ignored, Bootstrap uses CSS)
#
# WooCommerce PHP equivalent: global/breadcrumb.php
#
# @package WcBootstrap
# @since 0.1.0
#}
{% if breadcrumb is defined and breadcrumb|length > 0 %}
<nav aria-label="{{ __('Breadcrumb') }}">
<ol class="breadcrumb">
{% for crumb in breadcrumb %}
{% if not loop.last and crumb[1] is defined and crumb[1] %}
<li class="breadcrumb-item">
<a href="{{ crumb[1]|esc_url }}">{{ crumb[0]|esc_html }}</a>
</li>
{% else %}
<li class="breadcrumb-item active" aria-current="page">
{{ crumb[0]|esc_html }}
</li>
{% endif %}
{% endfor %}
</ol>
</nav>
{% endif %}