From 82637f46ac17e2d51ff5400d96e7f909950b8fa4 Mon Sep 17 00:00:00 2001 From: Nonimart Date: Thu, 12 Jun 2025 08:52:37 +0200 Subject: [PATCH] FEAT Developping the build-revue-authors list --- includes/api.php | 63 +++++------------------------------------------- 1 file changed, 6 insertions(+), 57 deletions(-) diff --git a/includes/api.php b/includes/api.php index dd7c6c6..e6ffc7d 100644 --- a/includes/api.php +++ b/includes/api.php @@ -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);