fixing frequent questions query problem

This commit is contained in:
Antoine M 2023-11-30 22:05:33 +01:00
parent b93eb1f3c8
commit 3959bc38b4

View File

@ -9,6 +9,14 @@ if (!function_exists('get_automatic_post')) {
'post_status' => 'publish', 'post_status' => 'publish',
'post_type' => 'questions', 'post_type' => 'questions',
'include_children' => true, 'include_children' => true,
'tax_query' => array(
array(
'taxonomy' => 'thematiques',
'field' => 'slug',
'terms' => $post_thematique->slug,
'include_children' => true,
)
)
); );
$posts = new WP_Query($automatic_query_args); $posts = new WP_Query($automatic_query_args);
@ -42,7 +50,7 @@ if (!function_exists('get_automatic_post')) {
// $thematique_datas = get_term_by('slug', $thematique->slug, 'thematiques'); // $thematique_datas = get_term_by('slug', $thematique->slug, 'thematiques');
$manual_data = get_field($thematique->slug . '_manual_data'); $manual_data = get_field($thematique->slug . '_manual_data');
$post_datas = $manual_data ? $manual_data : get_automatic_post($thematique->slug); $post_datas = $manual_data ? $manual_data : get_automatic_post($thematique);
get_template_part( get_template_part(
'template-components/cards/card-frequent-question', 'template-components/cards/card-frequent-question',
@ -52,6 +60,7 @@ if (!function_exists('get_automatic_post')) {
'post_ID' => $post_datas->ID, 'post_ID' => $post_datas->ID,
'post_title' => $post_datas->post_title, 'post_title' => $post_datas->post_title,
'post_excerpt' => $post_datas->post_excerpt, 'post_excerpt' => $post_datas->post_excerpt,
// 'post_url' => $post_datas->post_excerpt,
) )
); );
} }