REFactor archive templates: create new 'archive-dbmob.php' for dbmod post type, remove old 'archive-dbmod.php', and update content structure in 'content-dbmod.php' for improved layout and data presentation.

This commit is contained in:
Antoine 2025-05-12 16:58:48 +02:00
parent 1063ed8cd1
commit fb3a366421
4 changed files with 85 additions and 75 deletions

49
archive-dbmob.php Normal file
View File

@ -0,0 +1,49 @@
<?php
/**
* The template for displaying archive pages for the dbmod post type
*/
get_header(); ?>
<div class="archive-dbmob">
<div class="container">
<div class="page-heading">
<h1>
<span class="acronyme">DBMOB</span>
<span class="explanation"> Dictionnaire biographique du mouvement ouvrier en Belgique</span>
</h1>
<p>Découvrez notre rôle au sein du projet DBMOB et explorez les notices biographiques réalisées par léquipe du CARHOP. Ces portraits de militant·e·s retracent leurs engagements et contributions. </p>
</div>
<div class="post-grid">
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<?php get_template_part('template-parts/content', 'dbmod'); ?>
<?php endwhile; ?>
</div>
<div class="pagination">
<?php
the_posts_pagination(array(
'mid_size' => 2,
'prev_text' => __('Précédent', 'carhop'),
'next_text' => __('Suivant', 'carhop'),
));
?>
</div>
<?php else : ?>
<div class="col-12">
<?php get_template_part('template-parts/content', 'none'); ?>
</div>
<?php endif; ?>
</div>
</div>
<?php get_footer(); ?>

View File

@ -1,42 +0,0 @@
<?php
/**
* The template for displaying archive pages for the dbmod post type
*/
get_header(); ?>
<div class="container">
<div class="row">
<div class="col-12">
<h1 class="archive-title"><?php echo post_type_archive_title('', false); ?></h1>
</div>
</div>
<div class="row">
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<div class="col-md-4 mb-4">
<?php get_template_part('template-parts/content', 'dbmod'); ?>
</div>
<?php endwhile; ?>
<div class="col-12">
<?php
the_posts_pagination(array(
'mid_size' => 2,
'prev_text' => __('Précédent', 'carhop'),
'next_text' => __('Suivant', 'carhop'),
));
?>
</div>
<?php else : ?>
<div class="col-12">
<?php get_template_part('template-parts/content', 'none'); ?>
</div>
<?php endif; ?>
</div>
</div>
<?php get_footer(); ?>

View File

@ -1,6 +1,6 @@
.primary-menu-container { .primary-menu-container {
@apply mx-auto @apply mx-auto
bg-primary
text-white text-white
relative relative
h-fit h-fit
@ -35,11 +35,17 @@
xl:pr-24; xl:pr-24;
} }
li.menu-item:has(.page_icon) {
@apply flex flex-col items-center justify-center gap-3;
.page_icon {
@apply w-12 h-12 object-contain;
}
}
/* Highlight using list element */ /* Highlight using list element */
li.current-page-parent > a, li.current-page-parent > a,
li.current_page_item > a { li.current_page_item > a {
@apply font-medium @apply font-medium
text-white !text-white
decoration-secondary decoration-secondary
underline underline
underline-offset-8; underline-offset-8;
@ -55,7 +61,7 @@
@apply cursor-pointer @apply cursor-pointer
underline underline
underline-offset-8 underline-offset-8
text-secondary; !text-white;
} }
a:focus { a:focus {
text-decoration: none; text-decoration: none;
@ -65,7 +71,7 @@
.menu-item-submenu-toggle { .menu-item-submenu-toggle {
&:hover, &:hover,
&:focus { &:focus {
@apply text-secondary; @apply !text-white;
} }
@apply relative pr-4; @apply relative pr-4;
&:after { &:after {

View File

@ -5,7 +5,14 @@
*/ */
?> ?>
<article id="post-<?php the_ID(); ?>" <?php post_class('dbmod-item'); ?>> <?php
$chapo = get_field('chapo');
$content = get_field('content');
$author = get_field('author');
$maitron_url = get_field('maitron_url');
?>
<article id="post-<?php the_ID(); ?>" <?php post_class('post-card-dbmod'); ?>>
<div class="card h-100"> <div class="card h-100">
<?php if (has_post_thumbnail()) : ?> <?php if (has_post_thumbnail()) : ?>
<div class="card-img-top"> <div class="card-img-top">
@ -13,40 +20,30 @@
</div> </div>
<?php endif; ?> <?php endif; ?>
<div class="card-body"> <div class="post-card-dbmod__content">
<h2 class="card-title"> <h2 class="post-card-dbmod__title">
<a href="<?php the_permalink(); ?>"> <a href="<?php the_permalink(); ?>">
<?php the_title(); ?> <?php the_title(); ?>
</a> </a>
</h2> </h2>
<div class="card-text"> <?php if ($author) : ?>
<?php the_excerpt(); ?> <p class="author">par :<?php echo esc_html($author); ?></p>
</div>
<?php
// Afficher les champs ACF si présents
if (function_exists('get_field')) :
// Exemple d'affichage de champs ACF
$marque = get_field('marque');
$modele = get_field('modele');
$annee = get_field('annee');
?>
<div class="dbmod-details">
<?php if ($marque) : ?>
<p class="marque">Marque: <?php echo esc_html($marque); ?></p>
<?php endif; ?>
<?php if ($modele) : ?>
<p class="modele">Modèle: <?php echo esc_html($modele); ?></p>
<?php endif; ?>
<?php if ($annee) : ?>
<p class="annee">Année: <?php echo esc_html($annee); ?></p>
<?php endif; ?>
</div>
<?php endif; ?> <?php endif; ?>
<div class="post-card-dbmod__details">
<?php if ($chapo) : ?>
<p class="chapo"><?php echo esc_html($chapo); ?></p>
<?php endif; ?>
<?php if ($content) : ?>
<p class="content"><?php echo esc_html($content); ?></p>
<?php endif; ?>
<?php if ($maitron_url) : ?>
<p class="maitron_url">Maitron URL: <?php echo esc_html($maitron_url); ?></p>
<?php endif; ?>
</div>
</div> </div>
<div class="card-footer"> <div class="card-footer">