conditionnal no-found post-components if no post found

This commit is contained in:
Antoine M 2024-12-18 11:13:46 +01:00
parent 8dc45e970e
commit db9d6671d8

View File

@ -30,7 +30,6 @@ function build_search_artisan_posts_cards($request)
$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 = array_map('intval', $taxonomyIds);
@ -94,15 +93,15 @@ function build_search_artisan_posts_cards($request)
$html_template = ob_get_clean();
ob_start();
get_template_part(
'template-components/artisans/artisan-search-no-results',
null,
[]
);
$html_template = ob_get_clean();
if ($newsPostsDatas->found_posts === 0) {
ob_start();
get_template_part(
'template-components/artisans/artisan-search-no-results',
null,
[]
);
$html_template = ob_get_clean();
}
$response_data = array(
'html_template' => $html_template,
@ -147,7 +146,6 @@ function debugQueryTest()
);
$html_template = ob_get_clean();
$test = __("Aucun résultat trouvé", "metiers-patrimoine-theme");
// write_log($test);
return ($html_template);
}
// debugQueryTest();