FIX test fixing pictures
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Nonimart 2025-07-29 15:28:12 +02:00
parent ff03b6ba24
commit 43315bf28e

View File

@ -1,5 +1,19 @@
<?php
get_header();
$test = new WP_Query(array(
'post_type' => 'artisans',
'posts_per_page' => -1,
'post_status' => 'any',
));
foreach ($test->posts as $post) {
if ($post->post_status == 'publish' || $post->post_status == 'offline') continue;
// write_log($post->post_title);
// write_log($post->ID);
// write_log($post->post_status);
}
?>
<?php
@ -136,6 +150,7 @@ $pageIcon = get_field('page_icon', get_queried_object_id()) ?? null;
<?php
$artisans_id_fr = apply_filters('wpml_object_id', $post->ID, 'artisans', TRUE, 'fr');
$args = array(
'post_type' => 'chantiers',
'posts_per_page' => -1,
@ -148,6 +163,7 @@ $pageIcon = get_field('page_icon', get_queried_object_id()) ?? null;
)
);
$chantiers = new WP_Query($args);
// write_log($chantiers->posts);
?>
<?php if ($chantiers->posts): ?>
<section class="artisans-post__section artisans-post__section--chantiers">
@ -165,46 +181,53 @@ $pageIcon = get_field('page_icon', get_queried_object_id()) ?? null;
//########## FORCE GET_FIELD IN FR TO BE SURE WE HAVE SAME PICTURES BETWEEN FR AND NL ##########
$chantier_fr_id = apply_filters('wpml_object_id', $current_chantier_ID, 'chantiers', TRUE, 'fr');
$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
}
$pictures = get_field('pictures', $current_chantier_ID);
$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);
if ($current_chantier_ID === 8917 || $current_chantier_ID === 2732) {
write_log($current_chantier_ID);
write_log($chantier_name);
write_log($pictures);
}
// Si déjà en français, inutile de switcher
// if ($current_lang !== 'fr') {
// // LANGUAGE IS NL
// $chantier_name = get_field('chantier_name', $chantier_fr_id);
// // $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 {
// // LANGUAGE IS FR
// $pictures = get_field('pictures', $current_chantier_ID);
// $test = get_field_object('pictures', $chantier_fr_id);
// if ($chantier_fr_id == 2732) {
// write_log($test);
// write_log($chantier_name);
// // write_log($pictures);
// // write_log($pictures);
// write_log($chantier_fr_id);
// write_log(get_the_ID());
// // write_log($pictures);
// }
// // On est déjà en FR, on ne switch pas
// }
?>
<div class="chantier">