FEAT Developping the build-revue-authors list

This commit is contained in:
Nonimart 2025-06-12 08:52:37 +02:00
parent c6a223204c
commit 82637f46ac

View File

@ -21,70 +21,19 @@ add_action('rest_api_init', function () {
function build_revue_authors($request)
{
$revueID = esc_html($request->get_param('revue-id'));
write_log('revueID');
write_log($revueID);
// $previousActivePage = esc_html($request->get_param('active-page')) ?? 1;
// $activeTermID = esc_html($request->get_param('active-term-id'));
// $postsPerPage = esc_html($request->get_param('posts-per-page')) ?? 12;
ob_start();
get_template_part('template-parts/authors/revue-authors-list', null, array(
'revueID' => $revueID,
));
// $activePage = is_numeric($previousActivePage) ? $previousActivePage + 1 : 1;
// $taxQuery = $activeTermID && is_numeric($activeTermID) ? array(
// array(
// 'taxonomy' => 'news_type',
// 'field' => 'term_id',
// 'terms' => $activeTermID
// )
// ) : null;
// do_action('wpml_switch_language', $currentLanguage);
// $args = array(
// "status" => "publish",
// "post_type" => "post",
// "posts_per_page" => $postsPerPage,
// "paged" => $activePage,
// "tax_query" => $taxQuery
// );
// $newsPostsDatas = new WP_Query($args);
// ob_start();
// foreach ($newsPostsDatas->posts as $key => $post) {
// $post_thumbnail = get_the_post_thumbnail($post->ID, 'full', array('class' => 'card-news__thumbnail card-post__thumbnail')) ?? null;
// $news_type = get_the_terms($post->ID, "news_type") ?? null;
// $post_date = get_the_date('j.m.Y', $post->ID) ?? null;
// get_template_part(
// 'template-components/cards/card-news',
// null,
// array(
// 'card_variant' => 'activite',
// 'post_ID' => $post->ID,
// 'post_title' => get_the_title($post->ID),
// 'post_thumbnail' => $post_thumbnail,
// 'news_type' => $news_type,
// 'post_date' => $post_date,
// )
// );
// }
// $html_template = ob_get_clean();
// $response_data = array(
// 'html_template' => $html_template,
// 'total_posts_found' => $newsPostsDatas->found_posts,
// 'active_page' => $activePage,
// 'max_num_pages' => $newsPostsDatas->max_num_pages,
// );
$html_template = ob_get_clean();
$response_data = array(
'html_template' => $html_template,
'message' => 'Hello World',
);
$response = new WP_REST_Response($response_data);
$response->set_status(200);