Metiers_du_patrimoine_theme/front-page.php
Nonimart 97bb3f4b76
All checks were successful
continuous-integration/drone/push Build is passing
FEATURE Reversing site hierarchy
2025-09-01 14:30:44 +02:00

92 lines
2.8 KiB
PHP

<?php /* Template Name: Repertoire des métiers */ ?>
<?php get_header(); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php
$my_current_lang = apply_filters('wpml_current_language', NULL);
do_action('wpml_switch_language', 'fr');
$pageIcon = get_field('page_icon', 8209) ?? null;
do_action('wpml_switch_language', $my_current_lang);
$initialPosts = new WP_Query([
"post_status" => "publish",
"post_type" => "artisans",
"posts_per_page" => -1,
// "paged" => 1,
"orderby" => "title",
"order" => "ASC",
// "suppress_filters" => false,
]);
?>
<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 while ($initialPosts->have_posts()) : $initialPosts->the_post(); ?>
<?php
$post_date = get_the_date('j.m.Y', $initialPosts->ID) ?? null;
get_template_part(
'template-components/artisans/card-artisans-search',
null,
array(
'card_variant' => 'activite',
'post_ID' => get_the_ID(),
'post_title' => get_the_title(),
'current_taxonomy' => "elementsbatiments",
'post_date' => $post_date,
)
); ?>
<?php endwhile; ?>
</div>
</section>
</div>
<?php endwhile;
endif; ?>
<?php get_footer();