FEATURE Handling single authors
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Nonimart 2025-09-16 15:28:37 +02:00
parent 6ab16f4f65
commit 107673517e
4 changed files with 90 additions and 3 deletions

View File

@ -18,9 +18,9 @@
@import './components/revues-grid.css';
@import './components/articles-grid.css';
@import './components/post-card.css';
@import './components/post-card--revue.css';
@import './components/post-card--article.css';
@import './components/post-card.css';
@import './components/etiquettes-grid.css';
@import './components/author-card.css';
@import './components/authors-list.css';
@ -31,7 +31,6 @@
@import './components/index-panel.css';
@import './components/footnotes-index.css';
@import './components/article-revues-toolbar.css';
@import './components/post-card--article.css';
@import './components/authors-last-publications.css';
@import './components/article-references.css';
@import './components/article-informations.css';
@ -43,6 +42,7 @@
@import './pages/archive-revues.css';
@import './pages/archive-articles.css';
@import './pages/single-articles.css';
@import './pages/single-auteurs.css';
/* ########### LAYOUT ############ */
@import './layout/nav.css';

View File

@ -1,10 +1,16 @@
.post-card--article {
&.has-cover {
@apply gap-2;
.post-card__content {
@apply pl-6;
}
}
.post-card__title {
@apply text-2xl;
}
.post-card__authors {
@apply flex flex-wrap gap-8 pt-6;
@apply flex flex-wrap gap-x-8 gap-y-2 pt-6;
li {
@apply text-lg flex items-center gap-2;
&::before {

View File

@ -0,0 +1,13 @@
.page--single-auteurs {
@apply max-w-screen-xl mx-auto px-4;
h1 {
@apply !text-8xl uppercase mb-8 col-span-2;
}
&__header {
@apply grid grid-cols-2 gap-2 items-center justify-center py-12;
grid-template-columns: auto 1fr;
}
}

68
single-auteurs.php Normal file
View File

@ -0,0 +1,68 @@
<?php
get_header();
$author_id = get_the_ID();
$description = get_field('description', $author_id);
$profilePicture = get_field('profile_thumbnail', $author_id);
$profilePictureUrl = $profilePicture['url'] ?? '';
$profilePictureAlt = $profilePicture['alt'] ?? '';
?>
<div class="page--single-auteurs" data-author-id="<?php echo $author_id; ?>">
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<div class="page--single-auteurs__header">
<h1 class="page--single-auteurs__title"><?php the_title(); ?></h1>
<div class="author-card__profile-picture">
<?php if ($profilePictureUrl) : ?>
<img src="<?php echo $profilePictureUrl; ?>" alt="<?php echo $profilePictureAlt; ?>">
<?php else : ?>
<div class="author-card__profile-picture-placeholder">
</div>
<?php endif; ?>
</div>
<p><?php echo $description; ?></p>
</div>
<?php
$authorArticles = get_posts(array(
'post_type' => 'articles',
'posts_per_page' => -1,
'meta_query' => array(
array(
'key' => 'authors', // Ajustez selon votre structure
'value' => $author_id,
'compare' => 'LIKE'
)
),
));
?>
<ul class="post-grid__list">
<?php foreach ($authorArticles as $article) : ?>
<?php get_template_part('template-parts/articles/card-article', null, array(
'ID' => $article->ID,
'showAuthors' => true,
)); ?>
<?php endforeach; ?>
</ul>
<?php endwhile; ?>
<?php endif; ?>
</div>
<?php
get_footer();