diff --git a/single-artisans.php b/single-artisans.php index 4734aee..493063b 100644 --- a/single-artisans.php +++ b/single-artisans.php @@ -1,5 +1,19 @@ '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); +} + ?> 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); ?> posts): ?>
@@ -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 d’origine - - } 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 d’origine + + // } 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 + // } + + ?>