refactoring build function in api to return html template AND result_amounts
This commit is contained in:
parent
9244fea8e0
commit
5c947839b5
|
|
@ -150,7 +150,12 @@ function build_news_posts_feed_all($request)
|
||||||
|
|
||||||
$html_template = ob_get_clean();
|
$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);
|
$response->set_status(200);
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
|
|
@ -194,7 +199,14 @@ function build_news_posts_feed_per_type_id($request)
|
||||||
|
|
||||||
$html_template = ob_get_clean();
|
$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);
|
$response->set_status(200);
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user