From 582b7cf775254a167fd8913abf483100e6cc521c Mon Sep 17 00:00:00 2001 From: Antoine M Date: Fri, 13 Feb 2026 15:46:24 +0100 Subject: [PATCH] FEATURE Introducing nested reusable components to handle better content and archive page --- .../analyses-etudes/analyses-etudes-grid.php | 87 +++++++++++++++++ .../analyses-etudes/archives-header.php | 15 +++ .../analyses-etudes/card-analyse-etude.php | 42 +++++++++ .../toolbar-analyses-etudes.php | 58 ++++++++++++ .../components/archive/latest-parutions.php | 42 +++++++++ .../components/archive/post-grid.php | 93 +++++++++++++++++++ template-parts/components/content-meta.php | 28 ++++++ template-parts/components/post-card.php | 44 +++++++++ .../components/subscribe-infolettre.php | 7 ++ template-parts/expositions/archive-header.php | 15 +++ .../outils-pedagogiques/archive-header.php | 15 +++ template-parts/page-header.php | 3 +- 12 files changed, 448 insertions(+), 1 deletion(-) create mode 100644 template-parts/analyses-etudes/analyses-etudes-grid.php create mode 100644 template-parts/analyses-etudes/archives-header.php create mode 100644 template-parts/analyses-etudes/card-analyse-etude.php create mode 100644 template-parts/analyses-etudes/toolbar-analyses-etudes.php create mode 100644 template-parts/components/archive/latest-parutions.php create mode 100644 template-parts/components/archive/post-grid.php create mode 100644 template-parts/components/content-meta.php create mode 100644 template-parts/components/post-card.php create mode 100644 template-parts/components/subscribe-infolettre.php create mode 100644 template-parts/expositions/archive-header.php create mode 100644 template-parts/outils-pedagogiques/archive-header.php diff --git a/template-parts/analyses-etudes/analyses-etudes-grid.php b/template-parts/analyses-etudes/analyses-etudes-grid.php new file mode 100644 index 0000000..f291db7 --- /dev/null +++ b/template-parts/analyses-etudes/analyses-etudes-grid.php @@ -0,0 +1,87 @@ + 'analyses-etudes', + 'posts_per_page' => -1 +)); +$post_count = $analyses_etudes_posts->post_count; +$authors = get_posts(array( + 'post_type' => 'auteurs', + 'posts_per_page' => -1 +)); + +$types = get_terms(array( + 'taxonomy' => 'type', + 'hide_empty' => true, +)); + +?> + + +
+

Trouver une publication

+
+ +
+ +
+

Filtrer par

+
+ + + +
+ +
+
+ + + + + + + +
+ +

+ + + + + + +

+ + + +
+ + +
    + have_posts()) : ?> + have_posts()) : $analyses_etudes_posts->the_post(); ?> + get_the_ID(), + + )); ?> + + +
+
\ No newline at end of file diff --git a/template-parts/analyses-etudes/archives-header.php b/template-parts/analyses-etudes/archives-header.php new file mode 100644 index 0000000..aa5737e --- /dev/null +++ b/template-parts/analyses-etudes/archives-header.php @@ -0,0 +1,15 @@ + 'Analyses et études', + 'subtitle' => 'Accédez à nos recherches et publications thématiques', + 'description' => 'Le CARHOP produit des analyses et des études ancrées dans l’histoire sociale, en lien étroit avec les réalités du monde du travail et des mouvements sociaux. Ces productions visent à éclairer l’actualité par une lecture historique, critique et accessible.', + 'cover' => array( + 'url' => get_stylesheet_directory_uri() . '/resources/img/covers/carhop-page-analyses-etudes-cover.svg', + 'alt' => 'Revues' + ), + 'has_overlap' => true, + 'background_style' => 'sliced', + 'cta' => array( + 'title' => __('Trouver une publication', 'carhop'), + 'url' => '#prochaines-publications', + ) +)); diff --git a/template-parts/analyses-etudes/card-analyse-etude.php b/template-parts/analyses-etudes/card-analyse-etude.php new file mode 100644 index 0000000..18dd16e --- /dev/null +++ b/template-parts/analyses-etudes/card-analyse-etude.php @@ -0,0 +1,42 @@ + + +
+ + + +
+
+

+
+
+
+

+ + + + +
+ +
+ + +
\ No newline at end of file diff --git a/template-parts/analyses-etudes/toolbar-analyses-etudes.php b/template-parts/analyses-etudes/toolbar-analyses-etudes.php new file mode 100644 index 0000000..36f108f --- /dev/null +++ b/template-parts/analyses-etudes/toolbar-analyses-etudes.php @@ -0,0 +1,58 @@ + + + +
+ +
+

Filtrer par

+
+ + + +
+ +
+
+ + + + + + + +
+

+ + + + + + +

+ + + + + + +
\ No newline at end of file diff --git a/template-parts/components/archive/latest-parutions.php b/template-parts/components/archive/latest-parutions.php new file mode 100644 index 0000000..1e1ca5c --- /dev/null +++ b/template-parts/components/archive/latest-parutions.php @@ -0,0 +1,42 @@ + $post_type, + 'posts_per_page' => $post_amount, + 'orderby' => 'date', + 'order' => 'DESC', + +)); +$posts = $posts_query->posts; +$current_post_type = $args['current_post_type'] ?? get_post_type(); + +?> + + +
+ 1) : ?> +

Dernières parutions

+ +

Dernière parution

+ + + + +
+
+ + $current_post_type, + 'current_post_id' => $post->ID + )); ?> + + ID, 'medium'); ?> +

ID); ?>

+
+
+
+ +
\ No newline at end of file diff --git a/template-parts/components/archive/post-grid.php b/template-parts/components/archive/post-grid.php new file mode 100644 index 0000000..6fa74a3 --- /dev/null +++ b/template-parts/components/archive/post-grid.php @@ -0,0 +1,93 @@ + $current_post_type, + 'posts_per_page' => $post_amount +)); +$post_count = $posts_query->post_count; + +$types = get_terms(array( + 'taxonomy' => 'type', + 'hide_empty' => true, +)); + +// write_log($current_post_type_obj); + +?> + +
+

+
+ +
+ +
+

Filtrer par

+
+ + +
+ +
+
+ + + + + + +
+ +

+ + + + 1) : ?> + + labels->name; ?> + + + + labels->singular_name; ?> + + +

+ + + +
+ + +
    + have_posts()) : ?> + have_posts()) : $posts_query->the_post(); ?> + get_the_ID(), + )); ?> + + +
+
\ No newline at end of file diff --git a/template-parts/components/content-meta.php b/template-parts/components/content-meta.php new file mode 100644 index 0000000..54cf2c9 --- /dev/null +++ b/template-parts/components/content-meta.php @@ -0,0 +1,28 @@ +name +} else { + $current_post_type_obj = get_post_type_object($current_post_type); + $type = $current_post_type_obj->labels->singular_name; +} + +?> + + +
+ + + + + + +
\ No newline at end of file diff --git a/template-parts/components/post-card.php b/template-parts/components/post-card.php new file mode 100644 index 0000000..766b699 --- /dev/null +++ b/template-parts/components/post-card.php @@ -0,0 +1,44 @@ + + +
+ $current_post_type, + 'current_post_id' => $ID + )); ?> +
+
+

+
+
+
+ + + + +
    + +
  • post_title; ?>
  • + +
+ +
+ +
+ +
\ No newline at end of file diff --git a/template-parts/components/subscribe-infolettre.php b/template-parts/components/subscribe-infolettre.php new file mode 100644 index 0000000..88d83b8 --- /dev/null +++ b/template-parts/components/subscribe-infolettre.php @@ -0,0 +1,7 @@ + + +

Recevez les dernières actualités du CARHOP et la revue Dynamiques directement dans votre boîte mail. Abonnez-vous et surveillez votre boîte : un mail de confirmation vous attend ! 

+ +'; +echo do_blocks($block_content); diff --git a/template-parts/expositions/archive-header.php b/template-parts/expositions/archive-header.php new file mode 100644 index 0000000..9a8baf4 --- /dev/null +++ b/template-parts/expositions/archive-header.php @@ -0,0 +1,15 @@ + 'Expositions', + 'subtitle' => 'Découvrez nos expositions thématiques', + 'description' => 'Le CARHOP conçoit et diffuse des expositions ancrées dans l’histoire sociale, en lien étroit avec le monde du travail, les luttes collectives et les réalités contemporaines. Pensées comme des outils de transmission et de sensibilisation, elles rendent visibles des récits, des archives et des parcours souvent absents des discours dominants.', + 'cover' => array( + 'url' => get_stylesheet_directory_uri() . '/resources/img/covers/carhop-page-analyses-etudes-cover.svg', + 'alt' => 'Revues' + ), + 'has_overlap' => true, + 'background_style' => 'sliced', + 'cta' => array( + 'title' => __('Trouver une exposition', 'carhop'), + 'url' => '#prochaines-expositions', + ) +)); diff --git a/template-parts/outils-pedagogiques/archive-header.php b/template-parts/outils-pedagogiques/archive-header.php new file mode 100644 index 0000000..87906cf --- /dev/null +++ b/template-parts/outils-pedagogiques/archive-header.php @@ -0,0 +1,15 @@ + 'Outils pédagogiques', + 'subtitle' => 'Transmettre l’histoire sociale autrement', + 'description' => 'Le CARHOP développe des outils pédagogiques à partir de ses recherches, de ses archives et de ses expositions. Pensés pour les enseignant·es, formateur·rices, animateur·rices et publics variés, ces supports facilitent l’appropriation de l’histoire sociale et ouvrent le débat sur les enjeux d’hier et d’aujourd’hui.', + 'cover' => array( + 'url' => get_stylesheet_directory_uri() . '/resources/img/covers/carhop-page-analyses-etudes-cover.svg', + 'alt' => 'Revues' + ), + 'has_overlap' => true, + 'background_style' => 'sliced', + 'cta' => array( + 'title' => __('Trouver un outil pédagogique', 'carhop'), + 'url' => '#next-outils-pedagogiques', + ) +)); diff --git a/template-parts/page-header.php b/template-parts/page-header.php index 4d224af..5a9aa27 100644 --- a/template-parts/page-header.php +++ b/template-parts/page-header.php @@ -6,9 +6,10 @@ $description = $args['description']; $cover = $args['cover']; $background_style = $args['background_style'] ?? 'normal'; $cta = $args['cta']; +$has_overlap = $args['has_overlap'] ?? false; ?> -