sorting posts per thematique

This commit is contained in:
Antoine M 2023-12-14 17:23:45 +01:00
parent 35d9d8c711
commit cda5ce3013

View File

@ -9,6 +9,7 @@ $posts_per_page = 5;
$args = array( $args = array(
'post_type' => 'brochures', 'post_type' => 'brochures',
'posts_per_page' => $posts_per_page, 'posts_per_page' => $posts_per_page,
// 'posts_per_page' => -1,
'post_status' => 'publish', 'post_status' => 'publish',
'order' => 'DESC', 'order' => 'DESC',
'orderby' => 'date', 'orderby' => 'date',
@ -17,6 +18,15 @@ $args = array(
'meta_compare' => '!=', 'meta_compare' => '!=',
); );
$brochuresPosts = new WP_Query($args); $brochuresPosts = new WP_Query($args);
// $sortedBrochuresPosts = sort_posts_per_thematiques_priority($brochuresPosts);
// $sortedBrochuresPosts->posts = array_slice($sortedBrochuresPosts->posts, 0, $posts_per_page);
// $sortedBrochuresPosts->found_posts = $posts_per_page;
// $sortedBrochuresPosts->posts_per_page = $posts_per_page;
// $sortedBrochuresPosts->query_vars['posts_per_page'] = $posts_per_page;
// $sortedBrochuresPosts->post_count = $posts_per_page;
// #### FICHES INFOS QUERY // #### FICHES INFOS QUERY
$args = array( $args = array(
@ -31,6 +41,14 @@ $args = array(
); );
$fichesInfosPosts = new WP_Query($args); $fichesInfosPosts = new WP_Query($args);
// $sortedFichesInfosPosts = sort_posts_per_thematiques_priority($fichesInfosPosts);
// $sortedFichesInfosPosts->posts = array_slice($sortedBrochuresPosts->posts, 0, $posts_per_page);
// $sortedFichesInfosPosts->found_posts = $posts_per_page;
// $sortedFichesInfosPosts->posts_per_page = $posts_per_page;
// $sortedFichesInfosPosts->query_vars['posts_per_page'] = $posts_per_page;
// $sortedFichesInfosPosts->post_count = $posts_per_page;
// #### WEBINAIRES QUERY // #### WEBINAIRES QUERY
$args = array( $args = array(
'post_type' => 'videos-webinaires', 'post_type' => 'videos-webinaires',
@ -46,6 +64,7 @@ $videosWebinairesPosts = new WP_Query($args);
// $videosWebinairesDatas = get_field('videos_webinaires', $current_page_id)['videos_webinaires_datas'] ?? null; // $videosWebinairesDatas = get_field('videos_webinaires', $current_page_id)['videos_webinaires_datas'] ?? null;
$total_posts_found = $brochuresPosts->found_posts + $fichesInfosPosts->found_posts + $videosWebinairesPosts->found_posts; $total_posts_found = $brochuresPosts->found_posts + $fichesInfosPosts->found_posts + $videosWebinairesPosts->found_posts;
// $total_posts_found = $sortedBrochuresPosts->found_posts + $fichesInfosPosts->found_posts + $videosWebinairesPosts->found_posts;
?> ?>
<div class="template-archives template-archives--publications"> <div class="template-archives template-archives--publications">
@ -237,10 +256,6 @@ $total_posts_found = $brochuresPosts->found_posts + $fichesInfosPosts->found_pos
-----------------*/ ?> -----------------*/ ?>
<?php <?php
$sharePublications = get_field('section_share_publications', $current_page_id); $sharePublications = get_field('section_share_publications', $current_page_id);
// echo '<pre>';
// print_r($sharePublications);
// echo '</pre>';
?> ?>
<!-- <div id="highlighted-share-publication" class="highlighted-publication highlighted-share-publication"> <!-- <div id="highlighted-share-publication" class="highlighted-publication highlighted-share-publication">