From 6856fd24eb1e090b464efa5bba67477bae3c7b00 Mon Sep 17 00:00:00 2001 From: Antoine M Date: Thu, 30 Nov 2023 19:42:48 +0100 Subject: [PATCH] switching get automatic posts function to return wp-query --- .../home/questions-frequentes/questions-frequentes.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/template-blocks/home/questions-frequentes/questions-frequentes.php b/template-blocks/home/questions-frequentes/questions-frequentes.php index 5f0b3a2..a6c3f8d 100644 --- a/template-blocks/home/questions-frequentes/questions-frequentes.php +++ b/template-blocks/home/questions-frequentes/questions-frequentes.php @@ -8,11 +8,11 @@ if (!function_exists('get_automatic_post')) { 'post_per_page' => 1, 'post_status' => 'publish', 'post_type' => 'questions', - 'thematiques' => $post_thematique, 'include_children' => true, ); - return get_posts($automatic_query_args)[0] ?? null; + $posts = new WP_Query($automatic_query_args); + return $posts->posts[0] ?? null; } } @@ -44,6 +44,10 @@ if (!function_exists('get_automatic_post')) { $manual_data = get_field($thematique->slug . '_manual_data'); $post_datas = $manual_data ? $manual_data : get_automatic_post($thematique->slug); + echo '
';
+			print_r(get_permalink($post_datas));
+			echo '
'; + get_template_part( 'template-components/cards/card-frequent-question', null,