Metiers_du_patrimoine_theme/template-repertoire-des-metiers.php
Antoine M ee11cd9874
All checks were successful
continuous-integration/drone/push Build is passing
REFACTOR Search sidebar into a dedicated template part
2025-04-28 10:00:04 +02:00

79 lines
2.3 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([
"post_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">
<?php get_template_part("template-parts/artisan-filter-sidebar", null, array("foundPosts" => $initialPosts->found_posts)); ?>
<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();