<?php /** * L'Or des Plantes — Functions */ // 1. Enqueue styles add_action('wp_enqueue_scripts', function() { wp_enqueue_style('lodp-style', get_stylesheet_uri(), array('generate-style'), '1.0.5'); }); // 2. Pas de sidebar nulle part add_filter('generate_sidebar_layout', function() { return 'no-sidebar'; }); add_action('widgets_init', function() { unregister_widget('WP_Widget_Recent_Posts'); unregister_widget('WP_Widget_Recent_Comments'); unregister_widget('WP_Widget_Archives'); unregister_widget('WP_Widget_Categories'); unregister_widget('WP_Widget_Search'); }, 1); // 3. Custom footer remove_action('generate_footer', 'generate_construct_footer'); add_filter('generate_copyright', '__return_empty_string'); add_action('generate_after_footer', function() { ?> <footer class="lodp-footer"> <div class="lodp-footer-grid"> <div> <img src="<?php echo get_stylesheet_directory_uri(); ?>/logo.svg" alt="L'Or des Plantes" style="height:36px;margin-bottom:12px" onerror="this.style.display='none'"> <p style="color:var(--text-secondary);font-size:14px;line-height:1.6">Herboristerie ambulante depuis 1980.<br>Atelier : Sauve (30610), Gard<br>Marchés du Gard & Hérault</p> </div> <div><h4>Navigation</h4><a href="/">Accueil</a><a href="/boutique/">Boutique</a><a href="/histoire/">Notre histoire</a><a href="/contact/">Contact</a></div> <div><h4>Catégories</h4><a href="/categorie-produit/herboristerie-vrac-wcparticulier/">Herboristerie</a><a href="/categorie-produit/epices-wcparticulier/">Épices</a><a href="/categorie-produit/tisanes/">Tisanes</a><a href="/categorie-produit/cosmetiques/">Cosmétiques</a></div> <div><h4>Infos</h4><a href="/ou-nous-trouver/">Où nous trouver</a><a href="/contact/">Contact</a></div> </div> <div class="footer-bottom">© <?php echo date('Y'); ?> L'Or des Plantes. Tous droits réservés.</div> </footer> <?php }); // 4. Search overlay + JS add_action('wp_footer', function() { ?> <div class="lodp-search-overlay" id="lodp-search-overlay"> <button class="lodp-search-close" id="lodp-search-close" aria-label="Fermer"><svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg></button> <div class="lodp-search-overlay-inner"> <form role="search" method="get" action="<?php echo esc_url(home_url('/')); ?>"> <input type="search" name="s" placeholder="Rechercher un produit..." autocomplete="off" id="lodp-search-input"> <input type="hidden" name="post_type" value="product"> <button type="submit" aria-label="Rechercher"><svg width="28" height="28" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/></svg></button> </form> <div class="lodp-search-hint">Entrée pour rechercher · Échap pour fermer</div> </div> </div> <script> document.addEventListener('DOMContentLoaded',function(){ var t=document.getElementById('lodp-search-trigger'),o=document.getElementById('lodp-search-overlay'),c=document.getElementById('lodp-search-close'),i=document.getElementById('lodp-search-input'); if(t&&o){t.addEventListener('click',function(e){e.preventDefault();o.classList.add('open');setTimeout(function(){if(i)i.focus();},300);});} if(c&&o){c.addEventListener('click',function(){o.classList.remove('open');});o.addEventListener('click',function(e){if(e.target===o)o.classList.remove('open');});} document.addEventListener('keydown',function(e){if(e.key==='Escape'&&o&&o.classList.contains('open'))o.classList.remove('open');}); var h=document.querySelector('.lodp-hamburger'),n=document.querySelector('.lodp-nav'),ic=document.querySelector('.lodp-header-icons'); if(h&&n){h.addEventListener('click',function(){this.classList.toggle('open');n.classList.toggle('open');if(ic)ic.classList.toggle('open');});} }); </script> <?php }); // 5. Exclure catégories techniques (sync Dolibarr) add_filter('get_terms', function($terms, $taxonomy) { // $taxonomy can be array or string $taxes = is_array($taxonomy) ? $taxonomy : array($taxonomy); if (!in_array('product_cat', $taxes)) return $terms; $exclude = array('certification-bio','certification-bio-2','certification-bio-3','wcparticulier','wp-archive','non-classe-wcparticulier'); return array_filter($terms, function($t) use ($exclude) { return !in_array($t->slug, $exclude); }); }, 10, 2); // 6. Full width front page add_filter('generate_container_class', function($classes) { if (is_front_page()) $classes[] = 'full-width'; return $classes; }); // 7. Assigner les templates aux pages add_filter('template_include', function($template) { $templates = array( 'histoire' => 'page-histoire.php', 'contact' => 'page-contact.php', 'equipe' => 'page-equipe.php', 'ou-nous-trouver' => 'page-trouver.php', ); foreach ($templates as $slug => $file) { if (is_page($slug)) { $tpl = get_stylesheet_directory() . '/' . $file; if (file_exists($tpl)) return $tpl; } } return $template; }); // 8. Supprimer les sideblogs restants add_action('widgets_init', function() { unregister_widget('WP_Widget_Recent_Posts'); unregister_widget('WP_Widget_Recent_Comments'); unregister_widget('WP_Widget_Archives'); unregister_widget('WP_Widget_Categories'); unregister_widget('WP_Widget_Search'); }, 1); } return $html; }, 10, 2); } return $html; }, 10, 2); // Affiche le badge Certification Bio add_filter('woocommerce_product_get_image', function($html, $product) { if ($product && $product->get_meta('_certification_bio') === '1') { $badge = ''; $html = str_replace(' Archives des Encens & Bien-être - L'Or des Plantes

Encens & Bien-être

16 résultats affichésTrié par popularité