handle current language publication sorting with load more and filter
This commit is contained in:
parent
772c481cce
commit
867a565e5a
|
|
@ -56,12 +56,6 @@ add_action('rest_api_init', function () {
|
|||
'methods' => 'GET',
|
||||
'callback' => 'build_brochure_archive_rows',
|
||||
'permission_callback' => '__return_true',
|
||||
'args' => array(
|
||||
'excluded_ids' => array(
|
||||
'sanitize_callback' => 'sanitize_text_field',
|
||||
),
|
||||
),
|
||||
|
||||
));
|
||||
// * BUILD FICHE INFOS ARCHIVE ROWS
|
||||
register_rest_route('homegrade-datas/v1/build', '/fiche-info-archive-rows', array(
|
||||
|
|
@ -274,8 +268,12 @@ function build_brochure_archive_rows(WP_REST_Request $request)
|
|||
|
||||
return $response;
|
||||
}
|
||||
function build_fiches_info_archive_rows()
|
||||
function build_fiches_info_archive_rows(WP_REST_Request $request)
|
||||
{
|
||||
$currentLanguage = $request->get_param('current-page-language') ?? 'fr';
|
||||
|
||||
do_action('wpml_switch_language', $currentLanguage);
|
||||
|
||||
$args = array(
|
||||
'post_type' => 'fiches-infos',
|
||||
'posts_per_page' => -1,
|
||||
|
|
|
|||
|
|
@ -87,7 +87,11 @@ async function hydrateBrochureArchiveGrid() {
|
|||
}
|
||||
|
||||
async function hydrateFicheInfoArchiveGrid() {
|
||||
const response = await fetch(`/wp-json/homegrade-datas/v1/build/fiche-info-archive-rows`);
|
||||
const currentLanguage = document.querySelector('body').getAttribute('current-language');
|
||||
|
||||
const response = await fetch(
|
||||
`/wp-json/homegrade-datas/v1/build/fiche-info-archive-rows?current-page-language=${currentLanguage}`
|
||||
);
|
||||
ficheInfosDatas = await response.json();
|
||||
|
||||
const ficheInfoRows = document.querySelector('.fiches-infos-archives #fiche-infos-rows');
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user