Compare commits

..

No commits in common. "a22c049b6d5c448fcedeebfd2347ffc12787b9d3" and "fae6da09351892c2525209ccace1f4293be5e83d" have entirely different histories.

2 changed files with 7 additions and 74 deletions

View File

@ -1,5 +1,6 @@
<?php <?php
add_action('rest_api_init', function () { add_action('rest_api_init', function () {
/* ---------------- /* ----------------
@ -19,7 +20,6 @@ add_action('rest_api_init', function () {
// ################ ARTISANS ################ // ################ ARTISANS ################
function build_search_artisan_posts_cards($request) function build_search_artisan_posts_cards($request)
{ {
$currentLanguage = esc_html($request->get_param('current-page-language')) ?? 'fr'; $currentLanguage = esc_html($request->get_param('current-page-language')) ?? 'fr';
@ -29,9 +29,6 @@ function build_search_artisan_posts_cards($request)
$localisation = esc_html($request->get_param('localisation')) ?? null; $localisation = esc_html($request->get_param('localisation')) ?? null;
$StringifiedTaxonomyIds = esc_html($request->get_param('taxonomy-ids')) ?? null; $StringifiedTaxonomyIds = esc_html($request->get_param('taxonomy-ids')) ?? null;
do_action('wpml_switch_language', $currentLanguage);
$test = __("Aucun résultat trouvé", "metiers-patrimoine-theme");
$lang = apply_filters('wpml_current_language', null);
$taxonomyIds = explode(',', $StringifiedTaxonomyIds); $taxonomyIds = explode(',', $StringifiedTaxonomyIds);
$taxonomyIds = array_map('intval', $taxonomyIds); $taxonomyIds = array_map('intval', $taxonomyIds);
$search_value = sanitize_text_field($request->get_param('search')) ?? null; $search_value = sanitize_text_field($request->get_param('search')) ?? null;
@ -57,7 +54,7 @@ function build_search_artisan_posts_cards($request)
); );
} }
do_action('wpml_switch_language', $currentLanguage);
$args = array( $args = array(
"status" => "publish", "status" => "publish",
@ -96,19 +93,10 @@ function build_search_artisan_posts_cards($request)
$html_template = ob_get_clean(); $html_template = ob_get_clean();
ob_start();
echo __("test pour gilles", "metiers-patrimoine-theme");
get_template_part(
'template-components/artisans/artisan-search-no-results',
null,
[]
);
$html_template = ob_get_clean();
if ($newsPostsDatas->found_posts === 0) { if ($newsPostsDatas->found_posts === 0) {
$html_template = "<div class='no-results'><img class='no-results__cover' src='" . get_stylesheet_directory_uri() . "/resources/img/illustrations/Homegrade_resultats-filtres-cactus.svg' alt=''/><h3>" . __("Aucun résultat trouvé", "metiers-patrimoine-theme") . "</h3><p>" . __("Essayez d'ajouter un <span class='highlighted-purple'>filtre supplémentaire</span> pour trouver plus de résultats", "metiers-patrimoine-theme") . "</p></div>";
} }
$response_data = array( $response_data = array(
'html_template' => $html_template, 'html_template' => $html_template,
@ -121,14 +109,13 @@ function build_search_artisan_posts_cards($request)
$response = new WP_REST_Response($response_data); $response = new WP_REST_Response($response_data);
$response->set_status(200); $response->set_status(200);
// debugQueryTest( );
return $response; return $response;
} }
function debugQueryTest() function debugQueryTest()
{ {
$args = array( $args = array(
"status" => "publish", "status" => "publish",
"post_type" => "artisans", "post_type" => "artisans",
@ -141,55 +128,11 @@ function debugQueryTest()
$filteredPosts = []; $filteredPosts = [];
foreach ($newsPostsDatas as $post => $value) { foreach ($newsPostsDatas as $post => $value) {
// $persons = get_field('company_members', $value->ID); $persons = get_field('company_members', $value->ID);
// write_log($persons); write_log($persons);
} }
// write_log($newsPostsDatas->posts); write_log($newsPostsDatas->posts);
do_action('wpml_switch_language', 'nl');
ob_start();
get_template_part(
'template-components/artisans/artisan-search-no-results',
null,
[]
);
$html_template = ob_get_clean();
$test = __("Aucun résultat trouvé", "metiers-patrimoine-theme");
// write_log($test);
return ($html_template);
} }
// debugQueryTest(); // debugQueryTest();
add_action('wp_footer', 'debugQueryTest');
add_action('rest_api_init', function () {
register_rest_route('metiers-patrimoine-datas/v1/build', '/test', array(
'methods' => 'GET',
'callback' => 'handle_rest_callback_metiers',
));
});
function handle_rest_callback_metiers()
{
do_action('wpml_switch_language', 'nl');
ob_start();
get_template_part(
'template-components/artisans/artisan-search-no-results',
null,
[]
);
$html_template = ob_get_clean();
return array(
'html_template' => $html_template,
);
}

View File

@ -1,10 +0,0 @@
<?php
// $lang = apply_filters('wpml_current_language', null);
// write_log($lang);
?>
<h1><?php echo __("test pour gilles", "metiers-patrimoine-theme") ?></h1>
<div class='no-results'><img class='no-results__cover' src=" <?php get_stylesheet_directory_uri() . "/resources/img/illustrations/Homegrade_resultats-filtres-cactus.svg" ?>" alt='' />
<h3><?php echo __("Aucun résultat trouvé", "metiers-patrimoine-theme") ?> </h3>
<p> <?php echo __("Essayez d'ajouter un <span class='highlighted-purple'>filtre supplémentaire</span> pour trouver plus de résultats", "metiers-patrimoine-theme") ?></p>
</div>