43 lines
913 B
PHP
43 lines
913 B
PHP
<?php
|
|
|
|
add_action('rest_api_init', function () {
|
|
|
|
/* ----------------
|
|
BUILDING ROUTES
|
|
-----------------*/
|
|
|
|
// ################ NEWS ################
|
|
|
|
// * BUILD MORE NEWS CARDS
|
|
register_rest_route('dynamiques-datas/v1/build', '/revue/authors', array(
|
|
'methods' => 'GET',
|
|
'callback' => 'build_revue_authors',
|
|
'permission_callback' => '__return_true',
|
|
));
|
|
});
|
|
|
|
|
|
// ################ NEWS ################
|
|
|
|
function build_revue_authors($request)
|
|
{
|
|
$revueID = esc_html($request->get_param('revue-id'));
|
|
|
|
ob_start();
|
|
get_template_part('template-parts/authors/revue-authors-list', null, array(
|
|
'revueID' => $revueID,
|
|
));
|
|
|
|
$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);
|
|
|
|
return $response;
|
|
}
|