REFACTOR Search sidebar into a dedicated template part
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
f836164db7
commit
ee11cd9874
161
template-parts/artisan-filter-sidebar.php
Normal file
161
template-parts/artisan-filter-sidebar.php
Normal file
|
|
@ -0,0 +1,161 @@
|
|||
<?php
|
||||
$foundPosts = $args['foundPosts'] ?? null;
|
||||
?>
|
||||
|
||||
<aside class="metier-patrimoine-searchbar">
|
||||
<div class="metier-patrimoine-searchbar__results-indications">
|
||||
<p class="posts-results-count" role="status" aria-live="polite">
|
||||
<span class="results-count"><?php echo $foundPosts ?> </span>
|
||||
<span class="results-text">résultat(s) </span>
|
||||
</p>
|
||||
<div class="active-research-indicator" is-active="false">
|
||||
pour
|
||||
<button> <span class="current-queried-word"> </span> </button>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<form class="metier-patrimoine-searchform" action="">
|
||||
|
||||
<input type="hidden" value="1" name="active-page">
|
||||
|
||||
<fieldset class="metier-patrimoine-searchbar__search-by">
|
||||
<legend><?php echo __("Rechercher par", "metiers-patrimoine-theme") ?></legend>
|
||||
|
||||
<div class="search-radio-card search-radio-card--building-elements">
|
||||
<label for="building_elements"><?php echo __("Éléments du bâtiment", "metiers-patrimoine-theme") ?></label>
|
||||
<input type="radio" id="elements_batiments_checkbox" name="search_by" value="elementsbatiments" />
|
||||
</div>
|
||||
|
||||
<div class="search-radio-card search-radio-card--metiers">
|
||||
<label for="job_types"><?php echo __("Métiers du patrimoine", "metiers-patrimoine-theme") ?></label>
|
||||
<input type="radio" id="metiers_checkbox" name="search_by" value="metiers" />
|
||||
</div>
|
||||
</fieldset>
|
||||
<fieldset class="metier-patrimoine-searchbar__elements-batiments-filters">
|
||||
|
||||
<div class="fieldset-titling">
|
||||
<img class="fieldset-icon" src="<?php echo get_stylesheet_directory_uri() . '/resources/img/pictogrammes/Homegrade_repertoire-metiers.svg' ?>" alt=''>
|
||||
<h4 class="filter-title">Éléments du bâtiment</h4>
|
||||
</div>
|
||||
<ul>
|
||||
<?php
|
||||
|
||||
$terms_by_parent = getAllBatimentsTermsByParents();
|
||||
|
||||
// Afficher les termes parents et leurs enfants
|
||||
foreach ($terms_by_parent as $parent_term_data) :
|
||||
$parent_term = $parent_term_data['term'];
|
||||
?>
|
||||
<li class="checkbox-choice checkbox-choice-parent">
|
||||
<input class="parent-checkbox taxonomy-checkbox" type="checkbox" name="elementsbatiments[]" value="<?php echo esc_attr($parent_term->term_id); ?>" data-term="<?php echo esc_attr($parent_term->slug); ?>">
|
||||
<label>
|
||||
<?php echo esc_html($parent_term->name); ?>
|
||||
</label>
|
||||
|
||||
<?php if (!empty($parent_term_data['children'])) : ?>
|
||||
<ul class="checkbox-choice__subtaxonomy-list">
|
||||
<?php foreach ($parent_term_data['children'] as $child_term) : ?>
|
||||
<li class="checkbox-choice checkbox-choice-child">
|
||||
<input class="child-checkbox taxonomy-checkbox" type="checkbox" name="elementsbatiments[]" value="<?php echo esc_attr($child_term->term_id); ?>" data-term="<?php echo esc_attr($child_term->slug); ?>">
|
||||
<label>
|
||||
<?php echo esc_html($child_term->name); ?>
|
||||
</label>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
</li>
|
||||
<?php endforeach;
|
||||
?>
|
||||
</ul>
|
||||
</fieldset>
|
||||
|
||||
|
||||
<fieldset class="metier-patrimoine-searchbar__metiers-filters">
|
||||
|
||||
<div class="fieldset-titling">
|
||||
<img class="fieldset-icon" src="<?php echo get_stylesheet_directory_uri() . '/resources/img/pictogrammes/Homegrade_repertoire-elements.svg' ?>" alt=''>
|
||||
<h4 class="filter-title">Métiers</h4>
|
||||
</div>
|
||||
|
||||
<ul>
|
||||
<?php
|
||||
|
||||
$terms_by_parent = getAllMetiersTermsByParents();
|
||||
|
||||
foreach ($terms_by_parent as $parent_term_data) :
|
||||
$parent_term = $parent_term_data['term'];
|
||||
?>
|
||||
<li class="checkbox-choice checkbox-choice-parent">
|
||||
<input class="parent-checkbox taxonomy-checkbox" type="checkbox" name="metiers[]" value="<?php echo esc_attr($parent_term->term_id); ?>" data-term="<?php echo esc_attr($parent_term->slug); ?>">
|
||||
<label>
|
||||
<?php echo esc_html($parent_term->name); ?>
|
||||
</label>
|
||||
|
||||
<!-- Afficher les enfants sous forme de checkboxes -->
|
||||
<?php if (!empty($parent_term_data['children'])) : ?>
|
||||
<ul class="checkbox-choice__subtaxonomy-list">
|
||||
<?php foreach ($parent_term_data['children'] as $child_term) : ?>
|
||||
<li class="checkbox-choice checkbox-choice-child">
|
||||
|
||||
<input class="child-checkbox taxonomy-checkbox" type="checkbox" name="metiers[]" value="<?php echo esc_attr($child_term->term_id); ?>" data-term="<?php echo esc_attr($child_term->slug); ?>">
|
||||
<label>
|
||||
<?php echo esc_html($child_term->name); ?>
|
||||
</label>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
</li>
|
||||
<?php endforeach;
|
||||
?>
|
||||
</ul>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="metier-patrimoine-searchbar__geographic-filters">
|
||||
<div class="fieldset-titling">
|
||||
<img class="fieldset-icon" src="<?php echo get_stylesheet_directory_uri() . '/resources/img/pictogrammes/Homegrade_repertoire-elements.svg' ?>" alt=''>
|
||||
<h4 class="filter-title"><?php echo __("Localisation", "metiers-patrimoine-theme") ?></h4>
|
||||
</div>
|
||||
|
||||
<ul>
|
||||
<li class="checkbox-choice">
|
||||
<input class="localisation-checkbox" type="checkbox" name="localisation[]" value="all" checked>
|
||||
<label> <?php echo __("Toute la Belgique", "metiers-patrimoine-theme") ?></label>
|
||||
</li>
|
||||
<li class="checkbox-choice">
|
||||
<input class="localisation-checkbox" type="checkbox" name="localisation[]" value="wallonia" checked>
|
||||
<label><?php echo __("Wallonie", "metiers-patrimoine-theme") ?></label>
|
||||
</li>
|
||||
<li class="checkbox-choice">
|
||||
<input class="localisation-checkbox" type="checkbox" name="localisation[]" value="brussels" checked>
|
||||
<label> <?php echo __("Bruxelles", "metiers-patrimoine-theme") ?></label>
|
||||
</li>
|
||||
<li class="checkbox-choice">
|
||||
<input class="localisation-checkbox" type="checkbox" name="localisation[]" value="flanders" checked>
|
||||
<label> <?php echo __("Flandre", "metiers-patrimoine-theme") ?></label>
|
||||
</li>
|
||||
</ul>
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
<!-- search bar -->
|
||||
<form class="artisan-search-bar">
|
||||
<!-- <label for="search-input" class="sr-only"><?php echo __("Rechercher", "metiers-patrimoine-theme") ?></label> -->
|
||||
<input type="search" id="search-input" placeholder="<?php echo __("Rechercher", "metiers-patrimoine-theme") ?>" />
|
||||
<button class="search-button" type="submit">
|
||||
<img class="search_icon" src='<?php echo get_template_directory_uri() ?>/resources/img/graphic-assets/search-icon.svg' alt="Lancer la recherche">
|
||||
</button>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
$suggestArtisanPageId = 309;
|
||||
$suggestArtisanPageIcon = get_field('page_icon', $suggestArtisanPageId) ?? null;
|
||||
?>
|
||||
|
||||
<a class="card-suggest-artisan card block" href="<?php echo get_the_permalink($suggestArtisanPageId) ?>">
|
||||
<img class="search-artisan-btn__page-icon" src="<?php echo $suggestArtisanPageIcon['sizes']['medium_large'] ?> " alt="">
|
||||
<p><?php echo __("Communiquer une entreprise ou un artisan", "metiers-patrimoine-theme") ?></p>
|
||||
</a>
|
||||
</aside>
|
||||
|
|
@ -50,163 +50,7 @@ $initialPosts = new WP_Query([
|
|||
?>
|
||||
|
||||
<section class="artisans-posts">
|
||||
<aside class="metier-patrimoine-searchbar">
|
||||
<div class="metier-patrimoine-searchbar__results-indications">
|
||||
<p class="posts-results-count" role="status" aria-live="polite">
|
||||
<span class="results-count"><?php echo $initialPosts->found_posts; ?> </span>
|
||||
<span class="results-text">résultat(s) </span>
|
||||
</p>
|
||||
<div class="active-research-indicator" is-active="false">
|
||||
pour
|
||||
<button> <span class="current-queried-word"> </span> </button>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<form class="metier-patrimoine-searchform" action="">
|
||||
|
||||
<input type="hidden" value="1" name="active-page">
|
||||
|
||||
<fieldset class="metier-patrimoine-searchbar__search-by">
|
||||
<legend><?php echo __("Rechercher par", "metiers-patrimoine-theme") ?></legend>
|
||||
|
||||
<div class="search-radio-card search-radio-card--building-elements">
|
||||
<label for="building_elements"><?php echo __("Éléments du bâtiment", "metiers-patrimoine-theme") ?></label>
|
||||
<input type="radio" id="elements_batiments_checkbox" name="search_by" value="elementsbatiments" />
|
||||
</div>
|
||||
|
||||
<div class="search-radio-card search-radio-card--metiers">
|
||||
<label for="job_types"><?php echo __("Métiers du patrimoine", "metiers-patrimoine-theme") ?></label>
|
||||
<input type="radio" id="metiers_checkbox" name="search_by" value="metiers" />
|
||||
</div>
|
||||
</fieldset>
|
||||
<fieldset class="metier-patrimoine-searchbar__elements-batiments-filters">
|
||||
|
||||
<div class="fieldset-titling">
|
||||
<img class="fieldset-icon" src="<?php echo get_stylesheet_directory_uri() . '/resources/img/pictogrammes/Homegrade_repertoire-metiers.svg' ?>" alt=''>
|
||||
<h4 class="filter-title">Éléments du bâtiment</h4>
|
||||
</div>
|
||||
<ul>
|
||||
<?php
|
||||
|
||||
$terms_by_parent = getAllBatimentsTermsByParents();
|
||||
|
||||
// Afficher les termes parents et leurs enfants
|
||||
foreach ($terms_by_parent as $parent_term_data) :
|
||||
$parent_term = $parent_term_data['term'];
|
||||
?>
|
||||
<li class="checkbox-choice checkbox-choice-parent">
|
||||
<input class="parent-checkbox taxonomy-checkbox" type="checkbox" name="elementsbatiments[]" value="<?php echo esc_attr($parent_term->term_id); ?>" data-term="<?php echo esc_attr($parent_term->slug); ?>">
|
||||
<label>
|
||||
<?php echo esc_html($parent_term->name); ?>
|
||||
</label>
|
||||
|
||||
<?php if (!empty($parent_term_data['children'])) : ?>
|
||||
<ul class="checkbox-choice__subtaxonomy-list">
|
||||
<?php foreach ($parent_term_data['children'] as $child_term) : ?>
|
||||
<li class="checkbox-choice checkbox-choice-child">
|
||||
<input class="child-checkbox taxonomy-checkbox" type="checkbox" name="elementsbatiments[]" value="<?php echo esc_attr($child_term->term_id); ?>" data-term="<?php echo esc_attr($child_term->slug); ?>">
|
||||
<label>
|
||||
<?php echo esc_html($child_term->name); ?>
|
||||
</label>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
</li>
|
||||
<?php endforeach;
|
||||
?>
|
||||
</ul>
|
||||
</fieldset>
|
||||
|
||||
|
||||
<fieldset class="metier-patrimoine-searchbar__metiers-filters">
|
||||
|
||||
<div class="fieldset-titling">
|
||||
<img class="fieldset-icon" src="<?php echo get_stylesheet_directory_uri() . '/resources/img/pictogrammes/Homegrade_repertoire-elements.svg' ?>" alt=''>
|
||||
<h4 class="filter-title">Métiers</h4>
|
||||
</div>
|
||||
|
||||
<ul>
|
||||
<?php
|
||||
|
||||
$terms_by_parent = getAllMetiersTermsByParents();
|
||||
|
||||
foreach ($terms_by_parent as $parent_term_data) :
|
||||
$parent_term = $parent_term_data['term'];
|
||||
?>
|
||||
<li class="checkbox-choice checkbox-choice-parent">
|
||||
<input class="parent-checkbox taxonomy-checkbox" type="checkbox" name="metiers[]" value="<?php echo esc_attr($parent_term->term_id); ?>" data-term="<?php echo esc_attr($parent_term->slug); ?>">
|
||||
<label>
|
||||
<?php echo esc_html($parent_term->name); ?>
|
||||
</label>
|
||||
|
||||
<!-- Afficher les enfants sous forme de checkboxes -->
|
||||
<?php if (!empty($parent_term_data['children'])) : ?>
|
||||
<ul class="checkbox-choice__subtaxonomy-list">
|
||||
<?php foreach ($parent_term_data['children'] as $child_term) : ?>
|
||||
<li class="checkbox-choice checkbox-choice-child">
|
||||
|
||||
<input class="child-checkbox taxonomy-checkbox" type="checkbox" name="metiers[]" value="<?php echo esc_attr($child_term->term_id); ?>" data-term="<?php echo esc_attr($child_term->slug); ?>">
|
||||
<label>
|
||||
<?php echo esc_html($child_term->name); ?>
|
||||
</label>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
</li>
|
||||
<?php endforeach;
|
||||
?>
|
||||
</ul>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="metier-patrimoine-searchbar__geographic-filters">
|
||||
<div class="fieldset-titling">
|
||||
<img class="fieldset-icon" src="<?php echo get_stylesheet_directory_uri() . '/resources/img/pictogrammes/Homegrade_repertoire-elements.svg' ?>" alt=''>
|
||||
<h4 class="filter-title"><?php echo __("Localisation", "metiers-patrimoine-theme") ?></h4>
|
||||
</div>
|
||||
|
||||
<ul>
|
||||
<li class="checkbox-choice">
|
||||
<input class="localisation-checkbox" type="checkbox" name="localisation[]" value="all" checked>
|
||||
<label> <?php echo __("Toute la Belgique", "metiers-patrimoine-theme") ?></label>
|
||||
</li>
|
||||
<li class="checkbox-choice">
|
||||
<input class="localisation-checkbox" type="checkbox" name="localisation[]" value="wallonia" checked>
|
||||
<label><?php echo __("Wallonie", "metiers-patrimoine-theme") ?></label>
|
||||
</li>
|
||||
<li class="checkbox-choice">
|
||||
<input class="localisation-checkbox" type="checkbox" name="localisation[]" value="brussels" checked>
|
||||
<label> <?php echo __("Bruxelles", "metiers-patrimoine-theme") ?></label>
|
||||
</li>
|
||||
<li class="checkbox-choice">
|
||||
<input class="localisation-checkbox" type="checkbox" name="localisation[]" value="flanders" checked>
|
||||
<label> <?php echo __("Flandre", "metiers-patrimoine-theme") ?></label>
|
||||
</li>
|
||||
</ul>
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
<!-- search bar -->
|
||||
<form class="artisan-search-bar">
|
||||
<!-- <label for="search-input" class="sr-only"><?php echo __("Rechercher", "metiers-patrimoine-theme") ?></label> -->
|
||||
<input type="search" id="search-input" placeholder="<?php echo __("Rechercher", "metiers-patrimoine-theme") ?>" />
|
||||
<button class="search-button" type="submit">
|
||||
<img class="search_icon" src='<?php echo get_template_directory_uri() ?>/resources/img/graphic-assets/search-icon.svg' alt="Lancer la recherche">
|
||||
</button>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
$suggestArtisanPageId = 309;
|
||||
$suggestArtisanPageIcon = get_field('page_icon', $suggestArtisanPageId) ?? null;
|
||||
?>
|
||||
|
||||
<a class="card-suggest-artisan card block" href="<?php echo get_the_permalink($suggestArtisanPageId) ?>">
|
||||
<img class="search-artisan-btn__page-icon" src="<?php echo $suggestArtisanPageIcon['sizes']['medium_large'] ?> " alt="">
|
||||
<p><?php echo __("Communiquer une entreprise ou un artisan", "metiers-patrimoine-theme") ?></p>
|
||||
</a>
|
||||
</aside>
|
||||
<?php get_template_part("template-parts/artisan-filter-sidebar", null, array("foundPosts" => $initialPosts->found_posts)); ?>
|
||||
|
||||
<div class=" artisans-posts__grid">
|
||||
<?php
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user