Fix products, search, and newsletter form per REPA-17
- Search: replace static <a href="/?s="> with togglable search overlay form that submits post_type=product for proper WooCommerce results - Newsletter: remove mc4wp shortcode (plugin not installed), replace with self-contained HTML form + JS confirmation handler - Shop by Design: link each design card to real product_tag pages (passive-aggressive, email-signatures, meeting-recovery, etc.) and show live tag.count instead of hardcoded numbers - Category slugs: update $cat_meta mapping to match actual WC slugs (drinkware, wall-decor, stationery, apparel, stickers, accessories) in both front-page.php and archive-product.php - Footer dept links updated to real WC category slugs Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
@@ -176,7 +176,51 @@
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
// ─── WooCommerce quantity controls (override default +/-) ─────────────────
|
||||
// ─── Search overlay toggle ───────────────────────────────────────────────────
|
||||
window.rarToggleSearch = function () {
|
||||
var overlay = document.getElementById('rar-search-overlay');
|
||||
var btn = document.getElementById('rar-search-toggle');
|
||||
if (!overlay) return;
|
||||
var isHidden = overlay.hidden;
|
||||
overlay.hidden = !isHidden;
|
||||
if (btn) btn.setAttribute('aria-expanded', isHidden ? 'true' : 'false');
|
||||
if (isHidden) {
|
||||
var input = overlay.querySelector('input[type=search]');
|
||||
if (input) { input.focus(); input.select(); }
|
||||
}
|
||||
};
|
||||
|
||||
// Close search overlay on Escape key
|
||||
document.addEventListener('keydown', function (e) {
|
||||
if (e.key === 'Escape') {
|
||||
var overlay = document.getElementById('rar-search-overlay');
|
||||
if (overlay && !overlay.hidden) {
|
||||
overlay.hidden = true;
|
||||
var btn = document.getElementById('rar-search-toggle');
|
||||
if (btn) { btn.setAttribute('aria-expanded', 'false'); btn.focus(); }
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// ─── Newsletter form submit (placeholder handler) ─────────────────────────
|
||||
window.rarNewsletterSubmit = function (e, form) {
|
||||
e.preventDefault();
|
||||
var email = form.querySelector('input[type=email]');
|
||||
if (!email || !email.value) return false;
|
||||
var btn = form.querySelector('button[type=submit]');
|
||||
if (btn) {
|
||||
btn.textContent = 'Filed. ✓';
|
||||
btn.disabled = true;
|
||||
}
|
||||
if (email) {
|
||||
email.value = '';
|
||||
email.placeholder = 'You're on the list.';
|
||||
email.disabled = true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
// ─── WooCommerce quantity controls (override default +/-) ─────────────────
|
||||
// Replace WC's quantity input with our styled controls
|
||||
function initQtyControls() {
|
||||
document.querySelectorAll('.quantity:not(.rar-qty-init)').forEach(function (wrap) {
|
||||
|
||||
Reference in New Issue
Block a user