FIX Tweaks on heading box artisans
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Nonimart 2025-07-11 10:28:12 +02:00
parent ae3c6b95b8
commit d142147d4e
3 changed files with 65 additions and 16 deletions

View File

@ -1,7 +1,7 @@
.metiers-patrimoine-page-container--repertoire-metiers,
.metiers-patrimoine-page-container--single-artisans {
.heading-box {
@apply mt-12 lg:!mt-8 pb-6;
@apply mt-12 2xl:!mt-8 pb-6;
&__description {
@apply text-3xl max-w-screen-xl font-bold;
}
@ -14,4 +14,17 @@
/* width: unset; */
}
}
.heading-box--artisan {
@apply flex flex-col justify-center items-center gap-2 text-center;
.heading-box__description {
@apply uppercase font-medium text-xl tracking-widest;
line-height: 1.2;
}
.heading-box__subtitle {
@apply font-bold text-4xl pt-0 max-w-3xl pb-4;
text-transform: none;
}
}
}

View File

@ -1,6 +1,6 @@
.metiers-patrimoine-page-container--single-artisans {
.heading-box {
@apply !mt-8 pb-6 mb-4;
@apply !mt-14 pb-6 mb-4;
&__description {
@apply text-3xl max-w-screen-xl font-bold;
}

View File

@ -48,10 +48,10 @@ $pageIcon = get_field('page_icon', get_queried_object_id()) ?? null;
HEADING BOX
---------------*/ ?>
<?php
get_template_part("template-components/heading-box", null, array(
get_template_part("template-components/artisans/heading-box--artisan", null, array(
"pageIcon" => $pageIcon,
"title" => $currentPage->post_title,
"description" => __("En savoir plus sur nos artisans du patrimoine", "metiers-patrimoine-theme"),
"description" => __("En savoir plus sur cette entreprise", "metiers-patrimoine-theme"),
));
?>
@ -143,26 +143,62 @@ $pageIcon = get_field('page_icon', get_queried_object_id()) ?? null;
);
$chantiers = new WP_Query($args);
?>
<?php if ($chantiers->posts): ?>
<?php if ($chantiers->posts): ?>
<section class="artisans-post__section artisans-post__section--chantiers">
<h2 class="artisans-post__section-title"> <?php echo __(" Chantiers réalisés ", "metiers-patrimoine-theme") ?>
</h2>
<?php foreach ($chantiers->posts as $chantier): ?>
<?php while ($chantiers->have_posts()) : $chantiers->the_post(); ?>
<?php
$chantier_description = get_field('description', $chantier->ID);
$date = get_field('date', $chantier->ID);
$localisation = get_field('localisation', $chantier->ID) ?? null;
$current_chantier_ID = get_the_ID();
$chantier_description = get_field('description', $current_chantier_ID);
$date = get_field('date', $current_chantier_ID);
$localisation = get_field('localisation', $current_chantier_ID) ?? null;
$city = $localisation['city'] ?? null;
$current_id = get_the_ID();
//########## FORCE GET_FIELD IN FR TO BE SURE WE HAVE SAME PICTURES BETWEEN FR AND NL ##########
$chantier_fr_id = apply_filters('wpml_object_id', $chantier->ID, 'chantiers', TRUE, 'fr');
$current_lang = apply_filters('wpml_current_language', NULL);
do_action('wpml_switch_language', 'fr');
$pictures = get_field('pictures', $chantier_fr_id);
do_action('wpml_switch_language', $current_lang);
$chantier_fr_id = apply_filters('wpml_object_id', $current_chantier_ID, 'chantiers', TRUE, 'fr');
$chantier_name = get_field('chantier_name', $chantier->ID);
$current_lang = apply_filters('wpml_current_language', null);
// Si déjà en français, inutile de switcher
if ($current_lang !== 'fr') {
$pictures = get_field('pictures', $chantier_fr_id);
if ($chantier_fr_id == 2732) {
write_log($current_lang);
write_log("on est en NL ON SWITCHE");
do_action('wpml_switch_language', 'fr');
write_log($chantier_fr_id);
}
do_action('wpml_switch_language', $current_lang); // Revenir à la langue dorigine
} else {
$pictures = get_field('pictures', $current_chantier_ID);
$test = get_field_object('pictures', $chantier_fr_id);
if ($chantier_fr_id == 2732) {
// write_log($pictures);
write_log($test);
// write_log($chantier_fr_id);
// write_log($pictures);
write_log(get_the_ID());
// write_log($pictures);
}
// On est déjà en FR, on ne switch pas
}
$chantier_name = get_field('chantier_name', $current_chantier_ID);
if ($chantier_fr_id == 2732) {
// write_log($pictures);
// write_log(apply_filters('wpml_current_language', null));
// write_log($pictures);
}
?>
<div class="chantier">
@ -184,7 +220,7 @@ $pageIcon = get_field('page_icon', get_queried_object_id()) ?? null;
?>
</div>
<?php endforeach; ?>
<?php endwhile; ?>
</section>
<?php endif; ?>