Compare commits

...

27 Commits

Author SHA1 Message Date
Antoine M
8ef34620b7 FIX Problems in backend field display and scoping the gfield style to front end
All checks were successful
continuous-integration/drone/push Build is passing
2026-02-24 17:31:52 +01:00
Antoine M
fa49efc93b FEATURE Refining sub title styling 2026-02-24 17:31:14 +01:00
Antoine M
d3a8fe59ca FEATURE Introducing styling 2026-02-24 17:30:57 +01:00
Antoine M
32c4bb4610 FEATURE Introducing styling 2026-02-24 17:30:50 +01:00
Antoine M
0f2c1b5aa1 FEATURE Introducing styling 2026-02-24 17:30:44 +01:00
Antoine M
06473a3f8f FEATURE Introducing styling 2026-02-24 17:30:27 +01:00
Antoine M
24ef4eb48a FEATURE Handlming transitions and details text 2026-02-24 17:30:17 +01:00
Antoine M
b99356a4da FEATURE Updating file with new files import 2026-02-24 17:30:00 +01:00
Antoine M
a8f689f526 FEATURE Importing the new post-save file 2026-02-24 17:29:38 +01:00
Antoine M
db5972c2b7 FEATURE Introducxing new utilities functions 2026-02-24 17:29:25 +01:00
Antoine M
cb0ca9c8fe FEATURE introducing component 2026-02-24 17:29:06 +01:00
Antoine M
5c2f3d0aa5 REFACTOR Adapting template part import with new path 2026-02-24 17:28:52 +01:00
Antoine M
d495b9334c FEATURE introducing component 2026-02-24 17:28:07 +01:00
Antoine M
115bc14ff7 FEATURE introducing component 2026-02-24 17:27:59 +01:00
Antoine M
7b4454b8f4 FEATURE Handling numerotation and type terms 2026-02-24 17:27:42 +01:00
Antoine M
9fe976e115 REFACTOR Moving the card into the components subfolder 2026-02-24 17:27:19 +01:00
Antoine M
1e62d7b38c REFACTOR Moving the card into the components subfolder 2026-02-24 17:27:10 +01:00
Antoine M
b69d85eec8 REFACTROR Removing the yet unused component 2026-02-24 17:26:50 +01:00
Antoine M
7db5b6c3b3 REFACTOR Moving the card into the components subfolder 2026-02-24 17:26:16 +01:00
Antoine M
6d97d1db80 REFACTOR Moving the card into the components subfolder 2026-02-24 17:26:00 +01:00
Antoine M
00e6212bb8 FEATURE Handling the new frame-rotated variation 2026-02-24 17:24:37 +01:00
Antoine M
4167904e8c FEATURE Introducing a template part that create a front header block 2026-02-24 17:24:02 +01:00
Antoine M
7430cea756 FEATURE Handling the download button 2026-02-24 17:23:20 +01:00
Antoine M
65105eaca0 REFINE Adjusting last child 2026-02-24 17:22:58 +01:00
Antoine M
0b5aa2fdb6 FEATURE Ajout de marges pour les éléments de liste et les titres dans le style Gutenberg 2026-02-24 17:22:32 +01:00
Antoine M
2809656e60 FEATURE Introducing a reusable download cta component 2026-02-24 17:22:19 +01:00
Antoine M
39fadbd763 REFACTOR Moving analyses-etudes post type to a subfolder for better organisation 2026-02-24 17:21:35 +01:00
33 changed files with 960 additions and 53 deletions

View File

@ -15,7 +15,7 @@ require_once(__DIR__ . '/includes/rapport-activites.php');
require_once(__DIR__ . '/includes/equipe.php');
require_once(__DIR__ . '/includes/navwalker.php');
require_once(__DIR__ . '/includes/post-type-analyses-etudes.php');
require_once(__DIR__ . '/includes/posts-save.php');
// require_once(__DIR__ . '/includes/widget.php');
// require_once( __DIR__ . '/includes/taxonomy.php');
// require_once( __DIR__ . '/includes/errorlog.php');

View File

@ -104,3 +104,172 @@ function hasPostTypeNumerotation($post_type)
return false;
}
}
/**
* Retourne une WP_Query avec la dernière analyse et la dernière étude (une de chaque type).
* Utilisable comme une query classique (->posts, ->post_count, etc.).
*/
function get_last_analyses_etudes_posts()
{
$latest_analyse = get_posts(array(
'posts_per_page' => 1,
'post_status' => 'publish',
'post_type' => 'analyses-etudes',
'orderby' => 'date',
'order' => 'DESC',
'tax_query' => array(
array(
'taxonomy' => 'type',
'field' => 'slug',
'terms' => 'analyse',
),
),
));
$latest_etude = get_posts(array(
'posts_per_page' => 1,
'post_status' => 'publish',
'post_type' => 'analyses-etudes',
'orderby' => 'date',
'order' => 'DESC',
'tax_query' => array(
array(
'taxonomy' => 'type',
'field' => 'slug',
'terms' => 'etude',
),
),
));
$post_ids = array_merge(
array_map(function ($p) {
return $p->ID;
}, $latest_analyse),
array_map(function ($p) {
return $p->ID;
}, $latest_etude)
);
$post_ids = array_filter(array_unique($post_ids));
if (empty($post_ids)) {
return new WP_Query(array(
'post_type' => 'analyses-etudes',
'posts_per_page' => 0,
));
}
return new WP_Query(array(
'post_type' => 'analyses-etudes',
'post__in' => $post_ids,
'orderby' => 'post__in',
'posts_per_page' => count($post_ids),
));
}
/**
* Récupère le nombre de likes d'un post
*
* Cette fonction utilitaire récupère le compteur de likes stocké
* dans les métadonnées d'un post. Retourne 0 si aucun like n'existe.
*
* @param int $post_id L'ID du post
* @return int Le nombre de likes (0 si aucun)
*/
function get_post_likes_count($post_id)
{
$likes_count = get_post_meta($post_id, 'likes_count', true);
return $likes_count ? intval($likes_count) : 0;
}
/**
* Affiche le nombre de likes d'un post avec formatage
*
* Cette fonction utilitaire formate l'affichage du compteur de likes
* avec une icône optionnelle et la gestion du pluriel.
*
* @param int $post_id L'ID du post
* @param bool $show_icon Afficher l'icône cœur (défaut: true)
* @return string Le texte formaté (ex: "❤️ 5 likes" ou "3 like")
*/
function display_likes_count($post_id, $show_icon = true)
{
$likes_count = get_post_likes_count($post_id);
$icon = $show_icon ? '❤️ ' : '';
return $icon . $likes_count . ' like' . ($likes_count > 1 ? 's' : '');
}
/**
* Construit les URL de partage pour un post
*
* Cette fonction génère les URL de partage pour un post spécifique.
* Elle retourne un tableau associatif contenant les URL de partage pour Facebook, Twitter-X et LinkedIn.
*
* @return array Tableau associatif contenant les URL de partage
*/
function build_share_urls()
{
$post_id = get_the_ID();
$postUrl = get_permalink($post_id);
$postTitle = get_the_title($post_id);
$facebookUrl = 'https://www.facebook.com/sharer.php?u=' . $postUrl;
$twitterUrl = 'https://twitter.com/intent/tweet?text=' . $postTitle . '&url=' . get_the_permalink(get_the_id());
$linkedInUrl = 'https://www.linkedin.com/feed/?shareActive=true&text=' . $postTitle . ' ' . $postUrl;
return array(
'Facebook' => $facebookUrl,
'Twitter-X' => $twitterUrl,
'Linkedin' => $linkedInUrl,
'postUrl' => $postUrl
);
}
function get_author_publications_amount($authorID)
{
if (empty($authorID)) return 0;
if (get_current_blog_id() === 1) {
$posts = count_user_posts_by_author($authorID, array('expositions', 'outils-pedagogiques', 'analyses-etudes'));
return $posts;
}
if (get_current_blog_id() === 2) {
$posts = count_user_posts_by_author($authorID, 'articles');
return $posts;
}
return;
}
/**
* Compte le nombre d'articles d'un utilisateur pour un type de post donné
*
* Cette fonction compte combien d'articles d'un type spécifique
* sont associés à un utilisateur donné via le champ custom 'authors'.
*
* @param int $userID L'ID de l'utilisateur
* @param string $postType Le type de post à compter (ex: 'articles')
* @return int Le nombre d'articles trouvés
*/
function count_user_posts_by_author($userID, $postType)
{
$args = array(
'post_type' => $postType,
'meta_query' => array(
array(
'key' => 'authors',
'value' => '"' . $userID . '"',
'compare' => 'LIKE',
),
),
);
$query = new WP_Query($args);
return $query->found_posts;
}

View File

@ -35,10 +35,17 @@
@import './components/member-author-card.css';
@import './components/search-module.css';
@import './components/author-card.css';
@import './components/member-card.css';
@import './components/tablist.css';
@import './components/post-card.css';
@import './components/post-grid.css';
@import './components/card-analyse-etude.css';
@import './components/post-header.css';
@import './components/post-toolbar.css';
@import './components/listen-article.css';
@import './components/post-tag.css';
@import './components/content-wrapper.css';
@import './components/content-area.css';
/* ########### EDITOR CONTENT ############ */
@import './editor-content/entry-content.css';
@ -58,6 +65,8 @@
@import './pages/archive-dbmob.css';
@import './pages/archive-analyses-etudes.css';
@import './pages/archives.css';
@import './pages/singles.css';
@import './pages/single-auteurs.css';
/* ########### BLOCKS ############ */
@import './blocks/blocks-spacing.css';

View File

@ -108,6 +108,9 @@
p {
@apply text-primary text-lg;
}
> :last-child {
@apply !mb-0 !pb-0;
}
}
.narrative-card__content h1,
.narrative-card__content h2,

View File

@ -33,6 +33,12 @@
&__list {
@apply grid grid-cols-1 md:grid-cols-2 gap-8;
.communique-card {
&__inner {
@apply flex items-start justify-between gap-8;
}
.cta--download {
@apply shrink-0 py-0;
}
h3 {
@apply mb-6 text-2xl;
}

View File

@ -1,3 +1,4 @@
.wp-block-image.is-style-framed-rotated,
.wp-block-image.is-style-framed {
@apply border-2 p-4 w-fit bg-white;
--advised-text-color: currentColor;
@ -13,6 +14,7 @@
@apply -rotate-2;
}
}
.wp-block-image.is-style-stacked {
@apply w-fit bg-green-200 relative z-30 !mb-12;
@ -36,7 +38,8 @@
@apply content-[''] absolute inset-0 bg-white border border-primary w-full h-full top-0 left-0;
z-index: 10;
transform: translate(40px, 40px) rotate(-4deg);
background: linear-gradient(
background:
linear-gradient(
var(--wp--preset--color--primary),
var(--wp--preset--color--primary)
)

View File

@ -0,0 +1,48 @@
.content-area {
@apply max-w-screen-2xl mx-auto w-full;
.edito {
@apply border border-primary p-6 mb-12;
summary {
cursor: pointer;
@apply relative;
&::marker {
content: none;
}
&::after {
@apply absolute top-1/2 right-0 -translate-y-1/2;
transition: transform 0.3s ease-out;
background-image: url('../resources/img/elements/select-drop-button.svg');
/* background-image: url('../resources/img/icons/icon-activites.svg'); */
content: ' ';
@apply bg-contain;
/* @apply bg-red-500; */
@apply block w-12 h-12;
@apply rounded-full;
@apply mr-2;
}
}
&[open] {
summary::after {
transform: rotate(-180deg) translateY(50%);
}
}
&__title {
@apply text-3xl font-bold;
}
&__content {
@apply text-lg mt-6;
}
&__cta {
@apply my-4;
}
}
.table-matieres {
&__title {
@apply text-4xl font-bold mb-12;
}
.article-grid__list {
@apply grid grid-cols-1 gap-4;
}
}
}

View File

@ -0,0 +1,50 @@
#listen-article,
#stop-reading {
@apply rounded-full w-12 h-12 flex items-center justify-center m-0 p-0 transition-all duration-300;
}
#listen-article {
@apply bg-primary text-white;
&:hover {
@apply scale-110;
}
img {
@apply w-6 h-6;
}
&[data-reading-status='playing'] {
/* @apply bg-blue-500; */
@apply bg-white border border-primary;
/* &:hover {
@apply bg-red-500;
} */
#play-reading {
@apply hidden;
}
#pause-reading {
@apply block;
}
}
&[data-reading-status='stopped'] {
#play-reading {
@apply block;
}
#pause-reading {
@apply hidden;
}
}
&[data-reading-status='paused'] {
@apply bg-yellow-500;
#play-reading {
@apply block;
}
#pause-reading {
@apply hidden;
}
}
}
#stop-reading {
@apply bg-primary hidden;
img {
@apply w-4 h-4;
}
}

View File

@ -1,5 +1,10 @@
.post-card {
@apply bg-white border border-primary p-6;
transition: transform 0.3s ease-out;
&:hover {
transform: translateY(-4px);
}
h3.card__title {
@apply mb-6;
}
@ -33,11 +38,30 @@
@apply text-lg flex items-center gap-2;
&::before {
@apply w-6 h-6 block rounded-full bg-no-repeat bg-center bg-contain;
@apply w-6 h-6 block bg-no-repeat bg-center bg-contain;
content: '';
background-image: url('../resources/img/icons/carhop-plume.svg');
@apply filter-primary;
}
&.author::before {
background-image: url('../resources/img/icons/carhop-plume2.svg');
}
&.editor::before {
background-image: url('../resources/img/icons/carhop-bookmark.svg');
}
}
}
&__details-text {
@apply flex flex-col gap-2;
}
.tag-list {
@apply flex flex-wrap gap-2 mt-4;
&__tag {
@apply text-primary bg-white border border-solid border-primary px-4 py-2;
&:hover {
@apply bg-primary text-white;
}
}
}
}

View File

@ -0,0 +1,268 @@
.post-header {
@apply bg-primary text-white py-8 2xl:py-16 px-2 lg:px-4 md:px-8 overflow-x-hidden;
h1.post-header__title,
h2.post-header__title {
@apply uppercase font-medium text-4xl md:text-5xl lg:text-5xl text-white;
line-height: 1.2;
}
&__main-author {
@apply text-white font-light tracking-wide flex items-center gap-3 mt-4;
&::before {
@apply w-6 h-6 block bg-no-repeat bg-center bg-contain;
content: '';
background-image: url('../resources/img/icons/carhop-plume2.svg');
filter: invert(1) brightness(0) saturate(100%) invert(100%);
}
&:hover {
@apply underline underline-offset-8;
}
}
&__inner {
@apply mx-auto grid gap-24;
@screen xl {
@apply container;
}
@apply max-w-screen-2xl mx-auto;
&--has-thumbnail {
@screen lg {
grid-template-columns: 4fr 1fr;
}
}
&--no-thumbnail {
grid-template-columns: 1fr;
}
}
.content-meta__revue-issue {
@apply bg-white !text-primary;
}
.content-meta__type {
@apply text-white;
}
.thumbnail-wrapper {
@apply order-2 lg:order-1 relative z-20 h-fit;
width: calc(100% - 40px);
padding: 1.2rem;
/* max-width: calc(70% - 40px);
@apply mx-auto; */
@screen lg {
/* transform: translateX(-10px); */
}
&:before {
content: '';
@apply bg-white block absolute top-0 left-0 border border-carhop-green-700 w-full h-full z-10;
}
img {
aspect-ratio: 4/5;
/* max-height: 200px; */
@apply max-h-[200px] lg:max-h-full h-full relative z-10;
@apply object-cover;
/* width: calc(100% - 2rem);
height: calc(100% - 2rem);
margin: 0 auto; */
}
.thumbnail-overlay {
@apply absolute z-0 rotate-3 top-6 left-6 w-full h-full border border-primary bg-white flex items-center justify-center;
transform: translate(2px, 2px) rotate(2deg);
/* transform: translate(12px, 12px) rotate(3deg); */
background-image: linear-gradient(#efe8ff, #efe8ff);
background-size: calc(100% - 12px) calc(100% - 12px);
background-repeat: no-repeat;
background-position: center;
background-blend-mode: color-burn;
&:after {
content: '';
@apply bg-carhop-purple-200;
width: calc(100% - 2rem);
height: calc(100% - 2rem);
}
}
}
.post-details {
@apply flex flex-col xl:flex-row xl:justify-between gap-x-4 gap-y-8 mt-12;
grid-template-columns: 1fr 1fr;
&__label {
@apply uppercase font-bold text-lg text-white;
letter-spacing: 0.2em;
}
}
.socials-buttons {
@apply flex flex-wrap justify-start xl:justify-end gap-4 h-fit shrink-0;
@screen xl {
min-width: 570px;
}
&__button {
@apply bg-white text-carhop-green-700 px-4 lg:px-6 md:px-8 !py-3 lg:!py-4 font-normal rounded-full w-max flex items-center gap-2;
transition: transform 0.3s ease-in-out;
&:hover {
transform: scale(1.05);
}
&[disabled] {
@apply opacity-50 cursor-not-allowed;
}
img {
@apply w-7 h-7 filter-primary;
}
&--like {
transition: all 0.3s ease-in-out;
.button-action-text {
max-width: 0;
overflow: hidden;
white-space: nowrap;
}
.likes-count {
max-width: 200px;
overflow: hidden;
/* transition: max-width 0.3s ease-in-out; */
white-space: nowrap;
}
&[data-likes-count='0'] {
.button-action-text {
max-width: 200px;
}
.likes-count {
max-width: 0;
}
}
&:hover {
.button-action-text {
max-width: 200px;
transition: max-width 0.3s ease-in-out;
}
.likes-count {
max-width: 0;
}
}
&.is-disabled {
@apply opacity-100 cursor-not-allowed hover:opacity-80;
.likes-count {
@apply block;
}
.button-action-text {
@apply max-w-0;
}
}
&.is-disabled:hover {
.button-action-text {
@apply max-w-[200px];
}
.likes-count {
@apply max-w-0;
}
}
}
&--share {
.socials-buttons__share-links {
@apply max-w-0 opacity-0 overflow-hidden max-h-7;
transition: all 0.3s ease-in-out;
}
&.is-open .socials-buttons__share-links {
@apply max-w-[200px] opacity-100;
}
.share-icon {
@apply max-w-[200px];
}
&.is-open {
.share-icon {
@apply max-w-0 overflow-hidden;
}
.socials-buttons__share-links {
overflow: visible;
}
.share-button {
transform: scale(1) !important;
transition: transform 0.2s ease-in-out !important;
}
.share-button:hover {
transform: scale(1.02) !important;
}
.copy-link,
.share-link {
@apply block w-7 h-7;
&:hover {
}
}
}
.share-link {
display: inline-block;
transition: transform 0.2s ease-in-out !important;
&:hover {
transform: scale(1.2) !important;
}
}
}
}
&__share-links {
@apply flex flex-wrap gap-2;
}
.share-link {
@apply transition-all duration-300;
&:after {
content: none;
}
img {
@apply w-7 h-7 filter-none;
}
&--copy-link {
@apply relative bg-transparent border-0 p-0 cursor-pointer;
.copy-feedback {
@apply absolute left-1/2 -translate-x-1/2 -bottom-8 bg-white text-primary px-3 py-1 rounded-md text-sm font-medium whitespace-nowrap z-50;
animation: fadeIn 0.3s ease-in-out;
}
}
}
}
}
@keyframes fadeIn {
from {
opacity: 0;
transform: translate(-50%, -5px);
}
to {
opacity: 1;
transform: translate(-50%, 0);
}
}
.article-meta__related-revue {
flex-shrink: 1;
}
.article-meta__related-revue a {
@apply hover:underline underline-offset-8 text-white;
text-decoration-color: #fff;
text-decoration-thickness: 1px;
}
.article-meta__value {
@apply text-white font-light tracking-wide;
letter-spacing: 0.0015em;
}

View File

@ -0,0 +1,19 @@
.post-tag {
@apply w-fit bg-transparent px-3 py-2 relative text-primary border border-primary !list-none;
a {
text-decoration: none !important;
@apply block;
&:hover {
@apply !filter-none;
}
}
&:hover {
a {
@apply text-white;
}
@apply bg-primary text-white;
}
}
.post-tags-list {
@apply flex flex-wrap gap-2;
}

View File

@ -0,0 +1,11 @@
#post-toolbar {
@apply max-w-screen-2xl mx-auto;
}
.toolbar-actions {
@apply flex items-center gap-3 ml-auto;
@media screen and (max-width: 1024px) {
@apply absolute left-0 translate-y-full;
bottom: -20px;
}
}

View File

@ -48,7 +48,8 @@
}
}
}
form:not(:has(.gfield)) {
@apply form-carhop;
body.front-end {
form:not(:has(.gfield)) {
@apply form-carhop;
}
}

View File

@ -62,6 +62,19 @@ article > *:not(.entry-content),
@apply font-bold;
}
}
ul,
ol,
p {
@apply mb-6;
}
h1 {
@apply mb-10;
}
> h2,
> h3 {
@apply mb-3 mt-12;
font-size: 1.7rem;
}
}
}

View File

@ -70,9 +70,18 @@
@apply border-b border-white;
a {
@apply py-6 px-4 block w-full;
.page_subtitle {
@apply opacity-80 font-light mt-3 inline-block;
/* line-height: 1; */
}
.menu-item__content-inner {
transition: all 0.3s ease-out;
}
&:hover {
backdrop-filter: brightness(0.9);
backdrop-filter: brightness(0.8);
.menu-item__content-inner {
transform: translateX(4px);
}
}
}
&:last-child {
@ -87,6 +96,7 @@
}
a.menu-item__content {
transition: all 0.3s ease-out;
.menu-item__title {
@apply font-medium;
}

View File

@ -0,0 +1,88 @@
.page--single-auteurs {
@apply max-w-screen-xl mx-auto px-4;
&__header {
@apply py-12 !my-0 bg-primary alignfull pb-80;
h1 {
@apply !text-5xl uppercase mb-8 col-span-2 !text-white;
}
p {
@apply text-white;
}
.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-lg 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 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');
}
}
}
&__latest-publication {
transform: translateY(-200px);
margin-bottom: -150px;
p {
@apply text-white uppercase text-lg font-semibold tracking-widest mb-8;
}
}
}

View File

@ -0,0 +1,26 @@
.page-single {
.post-toolbar {
@apply px-8;
}
.tags__title {
@apply text-lg uppercase font-semibold mt-0 my-4 nunito;
}
.tags-list {
@apply flex flex-wrap gap-4;
}
.content-wrapper {
&[data-active-tab='post'] {
#post-authors {
@apply hidden;
}
}
&[data-active-tab='authors'] {
.post-content {
@apply hidden;
}
}
}
}

View File

@ -0,0 +1,51 @@
<?php
$postId = $args['postId'] ?? get_the_ID();
$authors = get_field('authors', $postId);
$isArticle = is_singular('articles');
if ($isArticle) {
$authors = get_field('authors', $postId);
} else {
$authors = getRevueAuthors($postId);
}
if (empty($authors)) return;
// Construire une meta_query avec OR pour chaque auteur
$meta_query = array('relation' => 'OR');
foreach ($authors as $author) {
$meta_query[] = array(
'key' => 'authors',
'value' => '"' . $author->ID . '"', // Recherche la valeur sérialisée
'compare' => 'LIKE'
);
}
$authorsLastPosts = get_posts(array(
'post_type' => $isArticle ? 'articles' : 'revues',
'posts_per_page' => 6,
'orderby' => 'date',
'order' => 'DESC',
'meta_query' => $meta_query,
));
if (empty($authorsLastPosts) || count($authorsLastPosts) < 2) return;
?>
<div class="authors-last-publications">
<?php if (count($authors) <= 1) : ?>
<h3 class="title-small">Ses dernières publications</h3>
<?php else : ?>
<h3 class="title-small">Leurs dernières publications</h3>
<?php endif; ?>
<?php foreach ($authorsLastPosts as $post) : ?>
<?php get_template_part('template-parts/articles/card-article', null, array(
'ID' => $post->ID,
'showAuthors' => true,
)); ?>
<?php endforeach; ?>
</div>
<?php wp_reset_postdata(); ?>

View File

@ -0,0 +1,21 @@
<?php
$postId = $args['postId'];
$componentTitle = 'Auteur·e·s de l\'article';
$authors = get_field('authors', $postId);
?>
<section class="authors-list">
<h3 class="authors-list__title"><?php echo $componentTitle; ?></h3>
<?php foreach ($authors as $author) : ?>
<?php get_template_part(
'template-parts/components/cards/author-card',
null,
array(
'ID' => $author->ID,
)
); ?>
<?php endforeach; ?>
</section>

View File

@ -1,26 +0,0 @@
<?php
$communique_id = $args['communique_id'];
$communique_file = get_field('file', $communique_id);
$communique_file_url = $communique_file['url'];
$communique_file_size = size_format($communique_file['filesize']);
$communique_file_type = $communique_file['subtype'];
?>
<div class="communique-card">
<?php get_template_part('template-parts/components/content-meta', null, array(
'current_post_type' => 'communique-presse',
'current_post_id' => $communique_id
)); ?>
<h3><?php echo get_the_title($communique_id); ?></h3>
<div class="communique-card__file-infos">
<time datetime="<?php echo get_the_date('Y-m-d', $communique_id); ?>"><?php echo get_the_date('d F Y', $communique_id); ?></time>
<?php if ($communique_file) : ?>
<span>|</span>
<span class="communique-card__file-type"><?php echo $communique_file_type; ?></span>
<span class="communique-card__file-size">(<?php echo $communique_file_size; ?>)</span>
<?php endif; ?>
</div>
<!-- <a href="<?php echo get_permalink($communique_id); ?>" class="button">Voir le communiqué</a> -->
</div>

View File

@ -82,7 +82,7 @@ $types = get_terms(array(
<ul class="post-grid__list">
<?php if (isset($posts_query) && $posts_query->have_posts()) : ?>
<?php while ($posts_query->have_posts()) : $posts_query->the_post(); ?>
<?php get_template_part('template-parts/components/post-card', null, array(
<?php get_template_part('template-parts/components/cards/post-card', null, array(
'ID' => get_the_ID(),
)); ?>
<?php endwhile; ?>

View File

@ -0,0 +1,43 @@
<?php
$ID = $args['ID'];
$name = get_the_title($ID);
$link = get_the_permalink($ID);
$profilePicture = get_field('profile_thumbnail', $ID);
$profilePictureUrl = $profilePicture['url'] ?? '';
$profilePictureAlt = $profilePicture['alt'] ?? '';
$description = get_field('description', $ID);
$is_carhop_member = get_field('is_carhop_member', $ID);
$carhop_member_id = get_field('carhop_member', $ID);
if ($is_carhop_member && isset($carhop_member_id)) {
switch_to_blog(1);
$description = get_field('description', $carhop_member_id);
$profilePicture = get_field('profile_thumbnail', $carhop_member_id);
$profilePictureUrl = $profilePicture['url'] ?? '';
$profilePictureAlt = $profilePicture['alt'] ?? '';
restore_current_blog();
}
?>
<a href="<?php echo $link; ?>" class="author-card">
<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>
<div class="author-card__infos">
<h3 class="author-card__name"><?php echo $name; ?></h3>
</div>
<div class="author-card__description">
<?php echo $description; ?>
</div>
</a>

View File

@ -0,0 +1,33 @@
<?php
$communique_id = $args['communique_id'];
$communique_file = get_field('file', $communique_id);
$communique_file_url = $communique_file['url'];
$communique_file_size = size_format($communique_file['filesize']);
$communique_file_type = $communique_file['subtype'];
?>
<div class="communique-card">
<?php get_template_part('template-parts/components/content-meta', null, array(
'current_post_type' => 'communique-presse',
'current_post_id' => $communique_id
)); ?>
<div class="communique-card__inner">
<div class="communique-card__content">
<h3><?php echo get_the_title($communique_id); ?></h3>
<div class="communique-card__file-infos">
<time datetime="<?php echo get_the_date('Y-m-d', $communique_id); ?>"><?php echo get_the_date('d F Y', $communique_id); ?></time>
<?php if ($communique_file) : ?>
<span>|</span>
<span class="communique-card__file-type"><?php echo $communique_file_type; ?></span>
<span class="communique-card__file-size">(<?php echo $communique_file_size; ?>)</span>
<?php endif; ?>
</div>
</div>
<?php get_template_part('template-parts/components/cta--download', null, array(
'url' => $communique_file_url,
'alt' => 'Télécharger le communiqué',
'target' => '_blank',
)); ?>
</div>
</div>

View File

@ -8,28 +8,27 @@ $member_email = get_field('email', $member_id);
$tumbnailPosition = get_field('profile_thumbnail_position', $member_id) ?? '50%';
?>
<li class="comity-type__item author-card">
<div class="author-card__profile-picture">
<li class="comity-type__item member-card">
<div class="member-card__profile-picture">
<?php if ($member_thumbnail) : ?>
<a href="<?php echo get_the_permalink($author->ID); ?>">
<a href="<?php echo get_the_permalink($member_id); ?>">
<img style="object-position: 50% <?php echo $tumbnailPosition; ?>%;" src="<?php echo $member_thumbnail['url']; ?>" alt="<?php echo $member_thumbnail['alt']; ?>">
</a>
<?php else : ?>
<a href="<?php echo get_the_permalink($member_id); ?>">
<div class="author-card__profile-picture-placeholder author-card__profile-picture-placeholder--<?php echo $placeholder_thumbnail_counter % 3 + 1; ?>n">
<!-- <img class="" src="<?php echo get_template_directory_uri(); ?>/assets/images/placeholder-author.png" alt="Placeholder author"> -->
<div class="member-card__profile-picture-placeholder member-card__profile-picture-placeholder--<?php echo $placeholder_thumbnail_counter % 3 + 1; ?>n">
</div>
</a>
<?php endif; ?>
</div>
<h4 class="author-card__name">
<h4 class="member-card__name">
<a href="<?php echo get_the_permalink($member_id); ?>"> <?php echo $member_full_name ?></a>
</h4>
<div class="author-card__bio"><?php echo $member_description; ?></p>
<div class="member-card__bio"><?php echo $member_description; ?></p>
<?php if ($member_email) : ?>
<a href="mailto:<?php echo $member_email; ?>" class="author-card__email cta cta--classic cta--rounded cta--has-icon cta--mailing">
<a href="mailto:<?php echo $member_email; ?>" class="member-card__email cta cta--classic cta--rounded cta--has-icon cta--mailing">
<div class="cta__icon">
<?php $mail_svg_path = get_template_directory() . '/resources/img/icons/carhop-mail.svg';
if (file_exists($mail_svg_path)) {

View File

@ -4,19 +4,24 @@ $current_post_type = $args['current_post_type'] ?? get_post_type();
$types_terms = get_the_terms($ID, 'type');
$type = isset($types_terms[0]) ? $types_terms[0] : null;
$title = get_the_title($ID);
$showExcerpt = $args['show_excerpt'] ?? false;
$excerpt = get_the_excerpt($ID);
$link = get_the_permalink($ID);
$image = get_the_post_thumbnail_url($ID);
$date = get_the_date('F Y', $ID);
$authors = get_field('authors', $ID);
$editors = get_field('editors', $ID);
$numerotation = get_post_meta($ID, 'post_numerotation', true);
$tags = get_the_terms($ID, 'etiquettes');
?>
<div class="post-card post-card--<?php echo $current_post_type; ?> card">
<a class="post-card post-card--<?php echo $current_post_type; ?> card" href="<?php echo $link; ?>">
<?php get_template_part('template-parts/components/content-meta', null, array(
'current_post_type' => $current_post_type,
'current_post_id' => $ID
@ -24,11 +29,13 @@ $numerotation = get_post_meta($ID, 'post_numerotation', true);
<div class="card__inner">
<div class="card__content">
<h3 class="card__title"><?php echo $title; ?></h3>
<div class="card__excerpt"><?php echo $excerpt; ?></div>
<?php if ($showExcerpt) : ?>
<div class="card__excerpt"><?php echo $excerpt; ?></div>
<?php endif; ?>
</div>
<div class="card__details">
<div class="card__details-text">
<div class="post-card__details-text">
<time datetime="<?php echo $date; ?>" class="card__details-date date"><?php echo $date; ?></time>
<?php if ($authors) : ?>
@ -36,6 +43,9 @@ $numerotation = get_post_meta($ID, 'post_numerotation', true);
<?php foreach ($authors as $author) : ?>
<li class="author"><?php echo $author->post_title; ?></li>
<?php endforeach; ?>
<?php foreach ($editors as $editor) : ?>
<li class="editor"><?php echo $editor->post_title; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</div>
@ -44,9 +54,16 @@ $numerotation = get_post_meta($ID, 'post_numerotation', true);
<?php the_post_thumbnail('medium'); ?>
</div>
<?php endif; ?>
<?php if ($tags) : ?>
<ul class="tag-list">
<?php foreach ($tags as $tag) : ?>
<li class="tag-list__tag"><?php echo $tag->name; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</div>
</div>
</div>
</a>

View File

@ -6,13 +6,15 @@ $current_post_type_supports_type = is_object_in_taxonomy($current_post_type, 'ty
$hasNumerotation = hasPostTypeNumerotation($current_post_type);
if ($current_post_type_supports_type) {
$type = get_the_terms($current_post_id, 'type') ?? null;
$type_term = get_the_terms($current_post_id, 'type')[0] ?? null;
if ($type_term) {
$type = $type_term->name;
}
// $current_post_type === 'analyses-etudes' && is_array($type) && !empty($type) && isset($type[0]->name
} else {
$current_post_type_obj = get_post_type_object($current_post_type);
$type = $current_post_type_obj->labels->singular_name;
}
?>
@ -22,9 +24,11 @@ if ($current_post_type_supports_type) {
<?php endif; ?>
<?php if ($hasNumerotation) : ?>
<?php
$numerotation = get_post_meta($current_post_id, 'post_numerotation', true); ?>
<p class="content-meta__revue-issue content-meta__revue-issue--green">
<span class="revue-issue-number revue-meta__label sr-only">Numéro</span>
28
<?php echo $numerotation; ?>
</p>
<?php endif; ?>
</div>

View File

@ -0,0 +1,9 @@
<?php
$url = $args['url'] ?? '#';
$alt = $args['alt'] ?? 'Lire la suite';
$target = $args['target'] ?? '_self';
$directDownload = $args['directDownload'] ?? false;
?>
<a href="<?php echo esc_url($url); ?>" class="cta cta--download cta--primary" target="<?php echo esc_attr($target); ?>"<?php echo $directDownload ? ' download' : ''; ?>>
<img src="<?php echo get_template_directory_uri(); ?>/resources/img/carhop-fleche-full-90.svg" alt="<?php echo $alt; ?>">
</a>

View File

@ -0,0 +1,8 @@
<?php
$block_content = '<!-- wp:front-header/front-header -->
<section class="wp-block-front-header-front-header alignfull block-front-header"><div class="front-header__innerblocks"><!-- wp:carhop-blocks/heading -->
<div class="wp-block-carhop-blocks-heading carhop-heading carhop-heading--hierarchy-classic"><div class="carhop-heading__innerblocks"><!-- wp:heading {"textAlign":"center","level":1,"style":{"elements":{"link":{"color":{"text":"var:preset|color|light"}}}},"textColor":"light"} -->
<h1 class="wp-block-heading has-text-align-center has-light-color has-text-color has-link-color">historique</h1>
<!-- /wp:heading -->';
echo do_blocks($block_content);

View File

@ -77,9 +77,9 @@ $types = get_terms(array(
<ul class="post-grid__list">
<?php if (isset($analyses_etudes_posts) && $analyses_etudes_posts->have_posts()) : ?>
<?php while ($analyses_etudes_posts->have_posts()) : $analyses_etudes_posts->the_post(); ?>
<?php get_template_part('template-parts/analyses-etudes/card-analyse-etude', null, array(
<?php get_template_part('template-parts/components/cards/post-card', null, array(
'ID' => get_the_ID(),
'current_post_type' => 'analyses-etudes',
)); ?>
<?php endwhile; ?>
<?php endif; ?>