You've already forked wc-bootstrap
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1e7f82615b |
@@ -2,6 +2,13 @@
|
|||||||
|
|
||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
|
## [0.1.8] - 2026-03-29
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- **Category tree restyled** (`category-tree.html.twig`, `category-tree-node.html.twig`): Switched from custom link classes to Bootstrap's native `list-group-item list-group-item-action` pattern with nested collapse divs for a more idiomatic Bootstrap look
|
||||||
|
- **Subtler active state** (`wc-bootstrap.css`): Replaced bold primary-colored background with light background (`var(--bs-tertiary-bg)`), left accent border (`3px solid var(--bs-primary)`), and semibold text for a less prominent highlight
|
||||||
|
|
||||||
## [0.1.7] - 2026-03-29
|
## [0.1.7] - 2026-03-29
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|||||||
13
CLAUDE.md
13
CLAUDE.md
@@ -345,10 +345,21 @@ The child theme inherits from `wp-bootstrap` via WordPress `Template: wp-bootstr
|
|||||||
|
|
||||||
## Version History
|
## Version History
|
||||||
|
|
||||||
Current version: **v0.1.7**
|
Current version: **v0.1.8**
|
||||||
|
|
||||||
## Session History
|
## Session History
|
||||||
|
|
||||||
|
### 2026-03-29 — v0.1.8 Restyle Category Tree to Idiomatic Bootstrap
|
||||||
|
|
||||||
|
**Scope:** Restyled the category tree sidebar to use Bootstrap's native `list-group-item-action` pattern with subtler active highlighting.
|
||||||
|
|
||||||
|
**Files modified (4):**
|
||||||
|
|
||||||
|
- `templates/global/category-tree.html.twig` — Switched to `list-group-item list-group-item-action` links in a `list-group-flush` container
|
||||||
|
- `templates/global/category-tree-node.html.twig` — Replaced nested `<ul>` lists with `<div>` wrappers and Bootstrap `collapse` divs; level indentation via inline `padding-left`
|
||||||
|
- `assets/css/wc-bootstrap.css` — Replaced primary-colored active background with subtle tertiary background, left accent border, and semibold text; removed unused `.category-tree-link` rules
|
||||||
|
- `style.css` — Version bump 0.1.7 → 0.1.8
|
||||||
|
|
||||||
### 2026-03-29 — v0.1.7 Add Product Category Tree Sidebar
|
### 2026-03-29 — v0.1.7 Add Product Category Tree Sidebar
|
||||||
|
|
||||||
**Scope:** Added a hierarchical product category tree sidebar to archive/shop and single product pages, with collapsible sub-levels up to 3 levels deep.
|
**Scope:** Added a hierarchical product category tree sidebar to archive/shop and single product pages, with collapsible sub-levels up to 3 levels deep.
|
||||||
|
|||||||
@@ -648,6 +648,7 @@ header.sticky-top.is-stuck {
|
|||||||
/* ==========================================================================
|
/* ==========================================================================
|
||||||
Category Tree Sidebar
|
Category Tree Sidebar
|
||||||
Hierarchical product category navigation with collapsible sub-levels.
|
Hierarchical product category navigation with collapsible sub-levels.
|
||||||
|
Uses Bootstrap list-group-item-action with subtle active styling.
|
||||||
========================================================================== */
|
========================================================================== */
|
||||||
|
|
||||||
.category-tree {
|
.category-tree {
|
||||||
@@ -658,24 +659,17 @@ header.sticky-top.is-stuck {
|
|||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
.category-tree-link {
|
/* Subtle active state: fw-semibold + left accent border instead of
|
||||||
color: var(--bs-body-color);
|
full primary background, keeping the look understated. */
|
||||||
transition: background-color 0.15s ease, color 0.15s ease;
|
.category-tree .list-group-item.active {
|
||||||
}
|
|
||||||
|
|
||||||
.category-tree-link:hover {
|
|
||||||
background-color: var(--bs-tertiary-bg);
|
background-color: var(--bs-tertiary-bg);
|
||||||
color: var(--bs-body-color);
|
color: var(--bs-body-color);
|
||||||
|
border-left: 3px solid var(--bs-primary);
|
||||||
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
|
|
||||||
.category-tree-link.active {
|
.category-tree .list-group-item.active small {
|
||||||
background-color: var(--bs-primary);
|
color: var(--bs-body-secondary) !important;
|
||||||
color: #fff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.category-tree-link.active .badge {
|
|
||||||
background-color: rgba(255, 255, 255, 0.2) !important;
|
|
||||||
color: #fff !important;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Rotate chevron icon when collapsed/expanded */
|
/* Rotate chevron icon when collapsed/expanded */
|
||||||
@@ -686,8 +680,3 @@ header.sticky-top.is-stuck {
|
|||||||
.category-tree-toggle[aria-expanded="false"] .bi {
|
.category-tree-toggle[aria-expanded="false"] .bi {
|
||||||
transform: rotate(-90deg);
|
transform: rotate(-90deg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Nested list indentation */
|
|
||||||
.category-tree .list-group-flush .list-group-flush {
|
|
||||||
padding-left: 0.75rem;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ Description: A Bootstrap 5 child theme for WP Bootstrap that overrides all WooCo
|
|||||||
Requires at least: 6.7
|
Requires at least: 6.7
|
||||||
Tested up to: 6.7
|
Tested up to: 6.7
|
||||||
Requires PHP: 8.3
|
Requires PHP: 8.3
|
||||||
Version: 0.1.7
|
Version: 0.1.8
|
||||||
License: GNU General Public License v2 or later
|
License: GNU General Public License v2 or later
|
||||||
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
||||||
Template: wp-bootstrap
|
Template: wp-bootstrap
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
{#
|
{#
|
||||||
# Single Category Tree Node (recursive)
|
# Single Category Tree Node (recursive)
|
||||||
#
|
#
|
||||||
# Renders one category with optional collapsible children.
|
# Renders one category as a list-group-item-action link with optional
|
||||||
# Included recursively by category-tree.html.twig.
|
# collapsible nested list for children. Included recursively.
|
||||||
#
|
#
|
||||||
# Expected context:
|
# Expected context:
|
||||||
# node - Category node from wc_bootstrap_get_category_tree()
|
# node - Category node from wc_bootstrap_get_category_tree()
|
||||||
@@ -12,22 +12,24 @@
|
|||||||
# @since 0.1.7
|
# @since 0.1.7
|
||||||
#}
|
#}
|
||||||
|
|
||||||
<li class="list-group-item px-0 py-1 border-0">
|
{% set has_children = node.children is not empty %}
|
||||||
|
{% set is_open = node.is_active or node.is_ancestor %}
|
||||||
|
|
||||||
|
<div class="category-tree-item">
|
||||||
<div class="d-flex align-items-center">
|
<div class="d-flex align-items-center">
|
||||||
<a href="{{ node.url }}"
|
<a href="{{ node.url }}"
|
||||||
class="category-tree-link d-block text-decoration-none py-1 px-2 rounded flex-grow-1{% if node.is_active %} active fw-semibold{% endif %}"
|
class="list-group-item list-group-item-action border-0 py-1 flex-grow-1{% if node.is_active %} active{% endif %}"
|
||||||
|
style="padding-left: {{ 0.5 + (level - 1) * 1 }}rem;"
|
||||||
{% if node.is_active %}aria-current="page"{% endif %}>
|
{% if node.is_active %}aria-current="page"{% endif %}>
|
||||||
<span class="ps-{{ (level - 1) * 2 }}">
|
{{ node.name }}
|
||||||
{{ node.name }}
|
<small class="text-body-secondary ms-1">({{ node.count }})</small>
|
||||||
</span>
|
|
||||||
<span class="badge bg-body-secondary text-body-secondary rounded-pill ms-1 small">{{ node.count }}</span>
|
|
||||||
</a>
|
</a>
|
||||||
{% if node.children is not empty %}
|
{% if has_children %}
|
||||||
<button class="btn btn-sm btn-link text-body-secondary p-0 ms-1 category-tree-toggle"
|
<button class="btn btn-sm btn-link text-body-secondary p-0 px-2 category-tree-toggle"
|
||||||
type="button"
|
type="button"
|
||||||
data-bs-toggle="collapse"
|
data-bs-toggle="collapse"
|
||||||
data-bs-target="#cat-{{ node.term_id }}"
|
data-bs-target="#cat-{{ node.term_id }}"
|
||||||
aria-expanded="{{ node.is_active or node.is_ancestor ? 'true' : 'false' }}"
|
aria-expanded="{{ is_open ? 'true' : 'false' }}"
|
||||||
aria-controls="cat-{{ node.term_id }}"
|
aria-controls="cat-{{ node.term_id }}"
|
||||||
aria-label="{{ __('Toggle subcategories', 'wc-bootstrap') }}">
|
aria-label="{{ __('Toggle subcategories', 'wc-bootstrap') }}">
|
||||||
<i class="bi bi-chevron-down small" aria-hidden="true"></i>
|
<i class="bi bi-chevron-down small" aria-hidden="true"></i>
|
||||||
@@ -35,12 +37,11 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% if node.children is not empty %}
|
{% if has_children %}
|
||||||
<ul class="list-group list-group-flush collapse{{ node.is_active or node.is_ancestor ? ' show' : '' }}"
|
<div class="collapse{{ is_open ? ' show' : '' }}" id="cat-{{ node.term_id }}">
|
||||||
id="cat-{{ node.term_id }}">
|
|
||||||
{% for child in node.children %}
|
{% for child in node.children %}
|
||||||
{% include 'global/category-tree-node.html.twig' with { node: child, level: level + 1 } only %}
|
{% include 'global/category-tree-node.html.twig' with { node: child, level: level + 1 } only %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</li>
|
</div>
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
{#
|
{#
|
||||||
# Product Category Tree (Bootstrap 5)
|
# Product Category Tree (Bootstrap 5)
|
||||||
#
|
#
|
||||||
# Renders a hierarchical product category navigation with collapsible
|
# Renders a hierarchical product category navigation using Bootstrap
|
||||||
# sub-levels, up to 3 levels deep. Uses Bootstrap 5 list-group and
|
# list-group with nested sub-lists and action links.
|
||||||
# collapse components for responsive tree navigation.
|
|
||||||
#
|
#
|
||||||
# Expected context:
|
# Expected context:
|
||||||
# categories - Hierarchical array from wc_bootstrap_get_category_tree()
|
# categories - Hierarchical array from wc_bootstrap_get_category_tree()
|
||||||
# shop_url - URL to the main shop page
|
# shop_url - URL to the main shop page
|
||||||
|
# current_cat - Term ID of the currently viewed category (0 = shop page)
|
||||||
#
|
#
|
||||||
# @package WcBootstrap
|
# @package WcBootstrap
|
||||||
# @since 0.1.7
|
# @since 0.1.7
|
||||||
@@ -19,16 +19,14 @@
|
|||||||
{{ __('Categories', 'wc-bootstrap') }}
|
{{ __('Categories', 'wc-bootstrap') }}
|
||||||
</h3>
|
</h3>
|
||||||
|
|
||||||
<ul class="list-group list-group-flush category-tree">
|
<div class="list-group list-group-flush category-tree">
|
||||||
<li class="list-group-item px-0 py-1">
|
<a href="{{ shop_url }}"
|
||||||
<a href="{{ shop_url }}"
|
class="list-group-item list-group-item-action border-0 px-2 py-1{% if current_cat == 0 %} active{% endif %}">
|
||||||
class="category-tree-link d-block text-decoration-none py-1 px-2 rounded{% if current_cat == 0 %} active fw-semibold{% endif %}">
|
{{ __('All products', 'wc-bootstrap') }}
|
||||||
{{ __('All products', 'wc-bootstrap') }}
|
</a>
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
{% for cat in categories %}
|
{% for cat in categories %}
|
||||||
{% include 'global/category-tree-node.html.twig' with { node: cat, level: 1 } only %}
|
{% include 'global/category-tree-node.html.twig' with { node: cat, level: 1 } only %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
Reference in New Issue
Block a user