From 52f988c72d6d6f7b222f65d7d7d4877338eaeff5 Mon Sep 17 00:00:00 2001 From: Antoine M Date: Tue, 24 Feb 2026 15:04:43 +0100 Subject: [PATCH] FEATURE Enlarging post numerotation handling to more post types and usiong a reusable function --- includes/posts-save.php | 17 +++++++++++++++++ includes/utilities.php | 23 +++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 includes/posts-save.php diff --git a/includes/posts-save.php b/includes/posts-save.php new file mode 100644 index 0000000..50ea7d6 --- /dev/null +++ b/includes/posts-save.php @@ -0,0 +1,17 @@ + $post_type, + 'posts_per_page' => -1, + 'orderby' => 'date', + 'order' => 'ASC', + )); + $numerotation = 0; + while ($query->have_posts()) { + $query->the_post(); + $numerotation++; + update_post_meta(get_the_ID(), 'post_numerotation', $numerotation); + } +} + + function hasPostTypeNumerotation($post_type) { switch ($post_type) {