From 2d8241ede01f6dc55204e28c06386ff5f4d3b2bc Mon Sep 17 00:00:00 2001 From: Nonimart Date: Thu, 25 Sep 2025 15:13:39 +0200 Subject: [PATCH] FEATURE Otpimizing author single --- includes/utilities.php | 7 ++ resources/css/pages/single-auteurs.css | 83 +++++++++++-- resources/img/icons/carhop-plume-white.svg | 12 ++ .../img/icons/carhop-rechercher-special.svg | 12 ++ single-auteurs.php | 113 +++++++++++++----- 5 files changed, 185 insertions(+), 42 deletions(-) create mode 100644 resources/img/icons/carhop-plume-white.svg create mode 100644 resources/img/icons/carhop-rechercher-special.svg diff --git a/includes/utilities.php b/includes/utilities.php index 4b18d3d..87224e9 100644 --- a/includes/utilities.php +++ b/includes/utilities.php @@ -38,6 +38,13 @@ function getRevueAuthors($revueID) return array_unique($authors); } +function get_author_articles_amount($authorID) +{ + if (empty($authorID)) return 0; + $articles = count_user_articles($authorID, 'articles'); + return $articles; +} + /** * Récupère tous les termes uniques d'une taxonomie pour une revue * diff --git a/resources/css/pages/single-auteurs.css b/resources/css/pages/single-auteurs.css index aed1723..366aedd 100644 --- a/resources/css/pages/single-auteurs.css +++ b/resources/css/pages/single-auteurs.css @@ -1,31 +1,88 @@ .page--single-auteurs { @apply max-w-screen-xl mx-auto px-4; - h1 { - @apply !text-8xl uppercase mb-8 col-span-2; - } - - .author-card__profile-picture { - @apply block static col-span-2 lg:col-span-1; - } &__header { - @apply grid grid-cols-1 gap-2 gap-x-8 items-center justify-center py-12; + @apply py-12 !my-0 bg-primary alignfull pb-80; + h1 { + @apply !text-6xl uppercase mb-8 col-span-2 !text-white; + } + p { + @apply text-white; + } - @screen lg { - grid-template-columns: auto 1fr; + .inner { + @apply mx-auto flex flex-col lg:flex-row gap-24 justify-center items-center max-w-screen-xl; + } + + .sub-infos { + @apply text-lg text-white flex gap-2 py-4; + + .data-type { + @apply uppercase font-medium text-xl tracking-widest; + } + + .articles-amount { + @apply flex items-center gap-2; + &::before { + content: ''; + @apply block w-6 h-6 bg-no-repeat bg-center; + background-image: url('../resources/img/icons/icon-activites.svg'); + background-size: contain; + } + } + } + .author-card__profile-picture { + @apply block col-span-2 lg:col-span-1 relative z-10 w-48 h-48 p-0; + .profile-picture-container { + @apply relative z-10 w-full h-full bg-white p-4; + z-index: 2; + } + .background-picture { + @apply absolute inset-0 w-full h-full bg-white; + z-index: -1; + transform: translate(30px, 30px) rotate(5deg); + + &:after { + content: ''; + @apply absolute inset-0 w-full h-full bg-carhop-green-100; + z-index: 2; + top: 1rem; + left: 1rem; + width: calc(100% - 2rem); + height: calc(100% - 2rem); + } + } + } + .infos { + @apply max-w-screen-md; } } &__comities-list { @apply flex flex-wrap gap-2 items-center col-span-2 text-primary font-normal pt-4; } &__comity { - @apply text-lg fjalla uppercase; + @apply text-lg flex items-center gap-2 font-light tracking-wide; + + &:before { + @apply content-[''] block w-6 h-6 bg-no-repeat bg-center; + background-size: contain; + } + .page--single-auteurs__comity { @apply before:content-['|'] before:mx-2 before:text-primary; } + &--redaction { + &:before { + background-image: url('../resources/img/icons/carhop-plume-white.svg'); + } + } } - &__comities-list-title { - @apply text-base font-normal text-neutral-400; + + &__latest-publication { + transform: translateY(-200px); + margin-bottom: -150px; + p { + @apply text-white uppercase text-xl font-semibold tracking-widest mb-8; + } } } diff --git a/resources/img/icons/carhop-plume-white.svg b/resources/img/icons/carhop-plume-white.svg new file mode 100644 index 0000000..d39e5de --- /dev/null +++ b/resources/img/icons/carhop-plume-white.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/resources/img/icons/carhop-rechercher-special.svg b/resources/img/icons/carhop-rechercher-special.svg new file mode 100644 index 0000000..3335d8a --- /dev/null +++ b/resources/img/icons/carhop-rechercher-special.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/single-auteurs.php b/single-auteurs.php index 52446ed..a20a4ab 100644 --- a/single-auteurs.php +++ b/single-auteurs.php @@ -7,7 +7,7 @@ $profilePicture = get_field('profile_thumbnail', $author_id); $profilePictureUrl = $profilePicture['url'] ?? ''; $profilePictureAlt = $profilePicture['alt'] ?? ''; $comity = get_field('comity', $author_id); - +$articlesAmount = get_author_articles_amount($author_id); ?> @@ -19,48 +19,103 @@ $comity = get_field('comity', $author_id);
+
+
+
+ + <?php echo $profilePictureAlt; ?> + +
-

+
+ +
+
+
+ +
+

+ Auteur·e + + + + + articles + + + + + +

+

+
+

+ +

+ + + + + + + +

+ -
- - <?php echo $profilePictureAlt; ?> - -
- -
-
-

- -

- - membre de : - - - - - - - -

- + +
+
+
+ +
+ +

Dernière publication

+ 'articles', + 'posts_per_page' => 1, + 'orderby' => 'date', + 'order' => 'DESC', + 'post_not_in' => array(913), + 'meta_query' => array( + array( + 'key' => 'authors', + 'value' => $author_id, + 'compare' => 'LIKE' + ) + ), + )); + + + if (isset($latestArticle[0])) : ?> + + $latestArticle[0]->ID, + 'showCover' => true, + + )); + ?> + + +
'articles', - 'posts_per_page' => -1, - + 'post__not_in' => array($latestArticle[0]->ID), 'meta_query' => array( array( 'key' => 'authors', // Ajustez selon votre structure