242 lines
9.2 KiB
PHP
242 lines
9.2 KiB
PHP
<?php /* Template Name: Repertoire des métiers */ ?>
|
|
|
|
|
|
<?php
|
|
get_header();
|
|
$pageIcon = get_field('page_icon', get_queried_object_id()) ?? null;
|
|
|
|
$initialPosts = new WP_Query([
|
|
"status" => "publish",
|
|
"post_type" => "artisans",
|
|
"posts_per_page" => -1,
|
|
"paged" => 1,
|
|
]);
|
|
|
|
?>
|
|
|
|
<div class="homegrade-page-container metiers-patrimoine-page-container--repertoire-metiers">
|
|
<nav class=" breadcrumbs_navigation" aria-label="<?php echo __("Vous êtes ici", "metiers-patrimoine-theme") ?>">
|
|
<?php
|
|
$currentPage = get_post(get_queried_object_id());
|
|
$networkHomeUrl = network_home_url();
|
|
|
|
$frontPageUrl = get_home_url();
|
|
$frontPageTitle = get_the_title(get_option('page_on_front'));
|
|
?>
|
|
<ol>
|
|
<li>
|
|
<a href="<?php echo $networkHomeUrl ?>" title="<?php echo __("Accueil", "metiers-patrimoine-theme") ?>">
|
|
<img src="<?php echo get_template_directory_uri() . "/resources/img/pictogrammes/icon_house_dark.svg" ?>" alt="">
|
|
</a>
|
|
</li>
|
|
|
|
<li><a href="<?php echo $frontPageUrl ?>"><?php echo $frontPageTitle ?></a></li>
|
|
|
|
<?php if ($currentPage) : ?>
|
|
<li><a href="<?php echo get_post_permalink($currentPage->ID) ?>" aria-current="location" aria-disabled="true"><?php echo $currentPage->post_title ?></a></li>
|
|
<?php endif; ?>
|
|
|
|
</ol>
|
|
</nav>
|
|
|
|
<?php /* --------
|
|
HEADING BOX
|
|
---------------*/ ?>
|
|
<?php
|
|
get_template_part("template-components/heading-box", null, array(
|
|
"pageIcon" => $pageIcon,
|
|
"title" => $currentPage->post_title,
|
|
"description" => __("Cherchez une entreprise ou un artisan", "metiers-patrimoine-theme"),
|
|
));
|
|
?>
|
|
|
|
|
|
<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>
|
|
|
|
<div class=" artisans-posts__grid">
|
|
<?php
|
|
|
|
|
|
foreach ($initialPosts->posts as $key => $artisanPost) {
|
|
$post_date = get_the_date('j.m.Y', $artisanPost->ID) ?? null;
|
|
|
|
get_template_part(
|
|
'template-components/artisans/card-artisans-search',
|
|
null,
|
|
array(
|
|
'card_variant' => 'activite',
|
|
'post_ID' => $artisanPost->ID,
|
|
'post_title' => get_the_title($artisanPost->ID),
|
|
'current_taxonomy' => "elementsbatiments",
|
|
'post_date' => $post_date,
|
|
)
|
|
);
|
|
}
|
|
?>
|
|
|
|
|
|
</div>
|
|
|
|
</section>
|
|
|
|
</div>
|
|
<?php get_footer();
|