Fix mobile hamburger menu, designs page template, product tab styling, and stock field (REPA-78)

- Add mobile hamburger toggle button and full-screen nav drawer (≤1024px)
- Fix product tab styles: complete tab CSS without relying on WC parent selectors; explicit wc-single-product enqueue on product pages
- Fix STOCK field: conditionally hide when get_stock_quantity() returns null instead of showing '— units'
- Add page-designs.php template + template_include filter so /designs/ uses themed layout instead of raw WooCommerce output
- Align nav/footer terminology: 'Canvas' → 'Wall Decor' in nav fallback; correct broken category URL slugs (mugs→drinkware, canvas→wall-decor, planners→stationery, blog→the-memo); add 'Bulk / HR' to mobile drawer

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
FrontendDev
2026-05-03 10:57:54 -04:00
parent 210a685630
commit 9bd61b4236
5 changed files with 303 additions and 2 deletions

View File

@@ -127,7 +127,7 @@ function rar_nav() {
['Shop', $shop_url],
['Designs', home_url('/designs/')],
['Mugs', home_url('/product-category/drinkware/')],
['Canvas', home_url('/product-category/wall-decor/')],
['Wall Decor', home_url('/product-category/wall-decor/')],
['Planners', home_url('/product-category/stationery/')],
['Apparel', home_url('/product-category/apparel/')],
['The Memo', home_url('/the-memo/')],
@@ -162,8 +162,45 @@ function rar_nav() {
</svg>
Cart (<?php echo esc_html($cart_count); ?>)
</a>
<button class="rar-nav__toggle" id="rar-nav-toggle" type="button"
onclick="rarToggleNav()" aria-label="Open navigation menu" aria-expanded="false" aria-controls="rar-nav-drawer">
<svg class="icon-open" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M3 6h18M3 12h18M3 18h18"></path>
</svg>
<svg class="icon-close" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M18 6L6 18M6 6l12 12"></path>
</svg>
</button>
</div>
</nav>
<!-- Mobile navigation drawer -->
<div class="rar-nav__drawer" id="rar-nav-drawer" role="dialog" aria-label="Navigation menu" aria-modal="true">
<button class="rar-nav__drawer-close" onclick="rarToggleNav()" aria-label="Close navigation">✕</button>
<?php
wp_nav_menu([
'theme_location' => 'primary',
'container' => false,
'items_wrap' => '%3$s',
'fallback_cb' => function() use ($shop_url) {
$links = [
['Shop', $shop_url],
['Designs', home_url('/designs/')],
['Mugs', home_url('/product-category/drinkware/')],
['Wall Decor', home_url('/product-category/wall-decor/')],
['Planners', home_url('/product-category/stationery/')],
['Apparel', home_url('/product-category/apparel/')],
['The Memo', home_url('/the-memo/')],
['About', home_url('/about/')],
['Bulk / HR', home_url('/bulk/')],
];
foreach ($links as [$label, $url]) {
echo '<a href="' . esc_url($url) . '">' . esc_html($label) . '</a>';
}
},
]);
?>
</div>
<div class="rar-search-overlay" id="rar-search-overlay" hidden>
<form class="rar-search-form" action="<?php echo esc_url(home_url('/')); ?>" method="get">
<input type="hidden" name="post_type" value="product" />
@@ -308,6 +345,24 @@ function rar_ajax_add_to_cart() {
wp_send_json_error();
}
// ─── Ensure WooCommerce single-product tab JS loads on product pages ─────────
add_action('wp_enqueue_scripts', function() {
if (is_singular('product')) {
wp_enqueue_script('wc-single-product');
}
}, 20);
// ─── Force designs page to use page-designs.php template ─────────────────────
add_filter('template_include', function($template) {
if (is_page('designs')) {
$custom = get_theme_file_path('page-designs.php');
if (file_exists($custom)) {
return $custom;
}
}
return $template;
});
// ─── Customizer settings ─────────────────────────────────────────────────────
add_action('customize_register', function($wp_customize) {
$wp_customize->add_section('rar_options', [