switching get automatic posts function to return wp-query

This commit is contained in:
Antoine M 2023-11-30 19:42:48 +01:00
parent 01c0115101
commit 6856fd24eb

View File

@ -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 '<pre>';
print_r(get_permalink($post_datas));
echo '</pre>';
get_template_part(
'template-components/cards/card-frequent-question',
null,