diff --git a/includes/api.php b/includes/api.php index 216f6c3..a03b823 100644 --- a/includes/api.php +++ b/includes/api.php @@ -150,7 +150,12 @@ function build_news_posts_feed_all($request) $html_template = ob_get_clean(); - $response = new WP_REST_Response($html_template); + $response_data = array( + 'html_template' => $html_template, + 'total_posts_found' => $newsPostsDatas->found_posts, + ); + + $response = new WP_REST_Response($response_data); $response->set_status(200); return $response; @@ -194,7 +199,14 @@ function build_news_posts_feed_per_type_id($request) $html_template = ob_get_clean(); - $response = new WP_REST_Response($html_template); + $response_data = array( + 'html_template' => $html_template, + 'total_posts_found' => $newsPostsDatas->found_posts, + ); + + + $response = new WP_REST_Response($response_data); + $response->set_status(200); return $response;