FEATURE Reversing site hierarchy
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Nonimart 2025-09-01 14:30:44 +02:00
parent 6fe1f0ff14
commit 97bb3f4b76
3 changed files with 108 additions and 108 deletions

View File

@ -1,41 +1,91 @@
<?php /* Template Name: Repertoire des métiers */ ?>
<?php get_header(); ?> <?php get_header(); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class="homegrade-page-container homegrade-page-container--metiers-patrimoine"> <?php
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
$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") ?>"> <nav class=" breadcrumbs_navigation" aria-label="<?php echo __("Vous êtes ici", "metiers-patrimoine-theme") ?>">
<?php <?php
$currentPage = get_post(); $currentPage = get_post(get_queried_object_id());
$parentPage = $currentPage->post_parent !== 0 ? get_post($currentPage->post_parent) : null; $networkHomeUrl = network_home_url();
$grandParentPage = $parentPage && $parentPage->post_parent ? get_post($parentPage->post_parent) : null;
$frontPageUrl = get_home_url();
$frontPageTitle = get_the_title(get_option('page_on_front'));
?> ?>
<ol> <ol>
<li> <li>
<a href="<?php echo home_url() ?>" title="<?php echo __("Accueil", "metiers-patrimoine-theme") ?>"> <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=""> <img src="<?php echo get_template_directory_uri() . "/resources/img/pictogrammes/icon_house_dark.svg" ?>" alt="">
</a> </a>
</li> </li>
<?php if ($grandParentPage) : ?>
<li><a href="<?php echo get_post_permalink($grandParentPage) ?>"><?php echo $grandParentPage->post_title ?></a></li> <li><a href="<?php echo $frontPageUrl ?>"><?php echo $frontPageTitle ?></a></li>
<?php endif; ?>
<?php if ($parentPage) : ?>
<li><a href="<?php echo get_post_permalink($parentPage) ?>"><?php echo $parentPage->post_title ?></a></li>
<?php endif; ?>
<?php if ($currentPage) : ?> <?php if ($currentPage) : ?>
<li><a href="<?php echo get_post_permalink($currentPage) ?>" aria-current="location" aria-disabled="true"><?php echo $currentPage->post_title ?></a></li> <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; ?> <?php endif; ?>
</ol> </ol>
</nav> </nav>
<?php /* --------
HEADING BOX
---------------*/ ?>
<?php <?php
the_content(); 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"),
));
?> ?>
<?php endwhile; ?>
<?php endif; ?> <section class="artisans-posts">
</div> <?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(); <?php get_footer();

41
template-about.php Normal file
View File

@ -0,0 +1,41 @@
<?php get_header(); ?>
<div class="homegrade-page-container homegrade-page-container--metiers-patrimoine">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<nav class=" breadcrumbs_navigation" aria-label="<?php echo __("Vous êtes ici", "metiers-patrimoine-theme") ?>">
<?php
$currentPage = get_post();
$parentPage = $currentPage->post_parent !== 0 ? get_post($currentPage->post_parent) : null;
$grandParentPage = $parentPage && $parentPage->post_parent ? get_post($parentPage->post_parent) : null;
?>
<ol>
<li>
<a href="<?php echo home_url() ?>" 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>
<?php if ($grandParentPage) : ?>
<li><a href="<?php echo get_post_permalink($grandParentPage) ?>"><?php echo $grandParentPage->post_title ?></a></li>
<?php endif; ?>
<?php if ($parentPage) : ?>
<li><a href="<?php echo get_post_permalink($parentPage) ?>"><?php echo $parentPage->post_title ?></a></li>
<?php endif; ?>
<?php if ($currentPage) : ?>
<li><a href="<?php echo get_post_permalink($currentPage) ?>" aria-current="location" aria-disabled="true"><?php echo $currentPage->post_title ?></a></li>
<?php endif; ?>
</ol>
</nav>
<?php
the_content();
?>
<?php endwhile; ?>
<?php endif; ?>
</div>
<?php get_footer();

View File

@ -1,91 +0,0 @@
<?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();