switching get automatic posts function to return wp-query
This commit is contained in:
parent
01c0115101
commit
6856fd24eb
|
|
@ -8,11 +8,11 @@ if (!function_exists('get_automatic_post')) {
|
||||||
'post_per_page' => 1,
|
'post_per_page' => 1,
|
||||||
'post_status' => 'publish',
|
'post_status' => 'publish',
|
||||||
'post_type' => 'questions',
|
'post_type' => 'questions',
|
||||||
'thematiques' => $post_thematique,
|
|
||||||
'include_children' => true,
|
'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');
|
$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->slug);
|
||||||
|
|
||||||
|
echo '<pre>';
|
||||||
|
print_r(get_permalink($post_datas));
|
||||||
|
echo '</pre>';
|
||||||
|
|
||||||
get_template_part(
|
get_template_part(
|
||||||
'template-components/cards/card-frequent-question',
|
'template-components/cards/card-frequent-question',
|
||||||
null,
|
null,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user