REFACTOR Cleaning write logs and tests
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Nonimart 2025-07-31 15:01:33 +02:00
parent 6e4d6f12c7
commit 70b0c7a89a

View File

@ -1,19 +1,5 @@
<?php <?php
get_header(); 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 <?php
@ -30,7 +16,7 @@ $pageIcon = get_field('page_icon', get_queried_object_id()) ?? null;
'meta_value' => 'template-repertoire-des-metiers.php' 'meta_value' => 'template-repertoire-des-metiers.php'
)); ));
//get page id with template Template Name: Repertoire des métiers //get page id
$frontPageUrl = get_home_url(); $frontPageUrl = get_home_url();
$frontPageTitle = get_the_title(get_option('page_on_front')); $frontPageTitle = get_the_title(get_option('page_on_front'));
@ -172,25 +158,25 @@ $pageIcon = get_field('page_icon', get_queried_object_id()) ?? null;
<?php while ($chantiers->have_posts()) : $chantiers->the_post(); ?> <?php while ($chantiers->have_posts()) : $chantiers->the_post(); ?>
<?php <?php
$current_lang = apply_filters('wpml_current_language', null);
$current_chantier_ID = get_the_ID(); $current_chantier_ID = get_the_ID();
$chantier_description = get_field('description', $current_chantier_ID); $chantier_description = get_field('description', $current_chantier_ID);
$date = get_field('date', $current_chantier_ID); $date = get_field('date', $current_chantier_ID);
$localisation = get_field('localisation', $current_chantier_ID) ?? null; $localisation = get_field('localisation', $current_chantier_ID) ?? null;
$city = $localisation['city'] ?? null; $city = $localisation['city'] ? translate_city_name($localisation['city'], $current_lang) : null;
$current_id = get_the_ID(); $current_id = get_the_ID();
//########## FORCE GET_FIELD IN FR TO BE SURE WE HAVE SAME PICTURES BETWEEN FR AND NL ########## //########## 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'); $chantier_fr_id = apply_filters('wpml_object_id', $current_chantier_ID, 'chantiers', TRUE, 'fr');
$current_lang = apply_filters('wpml_current_language', null);
$pictures = get_field('pictures', $current_chantier_ID); $pictures = get_field('pictures', $current_chantier_ID);
$chantier_name = get_field('chantier_name', $current_chantier_ID); $chantier_name = get_field('chantier_name', $current_chantier_ID);
if ($current_chantier_ID === 8917 || $current_chantier_ID === 2732) { if ($current_chantier_ID === 8917 || $current_chantier_ID === 2732) {
write_log($current_chantier_ID); // write_log($current_chantier_ID);
write_log($chantier_name); // write_log($chantier_name);
write_log($pictures); // write_log($pictures);
} }