Compare commits

...

4 Commits

Author SHA1 Message Date
Nonimart
38a7fac143 SUPPRIMER le fichier CSS de la carte d'auteur
Some checks failed
continuous-integration/drone/push Build is failing
2025-11-25 16:00:49 +01:00
Nonimart
98f628a05a FEATURE handling new carhiop member synchronisation 2025-11-25 16:00:27 +01:00
Nonimart
5d14c64fa8 FEATURE Ajout de la gestion des membres Carhop pour afficher des informations spécifiques 2025-11-25 15:59:38 +01:00
Nonimart
8a0065e1c6 FIX Ajout de la classe 'is-website-dynamiques' au corps pour une meilleure identification du site 2025-11-25 15:59:19 +01:00
5 changed files with 91 additions and 88 deletions

View File

@ -13,7 +13,7 @@
<?php wp_head(); ?>
</head>
<body <?php body_class("front-end"); ?>>
<body <?php body_class("front-end is-website-dynamiques"); ?>>
<?php
do_action('tailpress_site_before');
global $post;

View File

@ -44,19 +44,74 @@ function dynamiques_save_auteurs_post($post_id)
{
$post_type = get_post_type($post_id);
if ($post_type == 'auteurs') {
$first_name = get_field('first_name', $post_id) ?? '';
$last_name = get_field('last_name', $post_id) ?? '';
if ($post_type !== 'auteurs') return;
$full_name = $first_name . ' ' . $last_name;
$is_carhop_member = $_POST['acf']['field_691c8279b6458'];
$carhop_member_id = $_POST['acf']['field_691c831e94029'] ?? null;
if ($full_name && $full_name != '') {
$post_slug = sanitize_title($full_name);
wp_update_post(array(
'ID' => $post_id,
'post_title' => $full_name,
'post_name' => $post_slug
));
}
$first_name = null;
$last_name = null;
if (!$is_carhop_member) {
$first_name = get_field('first_name', $post_id);
$last_name = get_field('last_name', $post_id);
}
if (isset($is_carhop_member) && isset($carhop_member_id)) {
switch_to_blog(1);
$first_name = get_field('first_name', $carhop_member_id);
$last_name = get_field('last_name', $carhop_member_id);
$comity = get_field('comity', $carhop_member_id);
write_log($comity);
// $membre_carhop = get_post($carhop_member_id);
// write_log($_POST['acf']);
// $description = get_field('description', $carhop_member_id);
// $comity = get_field('comity', $carhop_member_id);
// $email = get_field('email', $carhop_member_id);
// write_log($first_name);
// write_log($last_name);
// write_log($description);
// write_log($email);
$display_name = $first_name . ' ' . $last_name;
restore_current_blog();
update_field('comity', $comity, $post_id);
}
$full_name = $first_name . ' ' . $last_name;
if (isset($first_name) && isset($last_name) && isset($full_name) && $full_name != '') {
$post_slug = sanitize_title($full_name);
wp_update_post(array(
'ID' => $post_id,
'post_title' => $full_name,
'post_name' => $post_slug
));
}
}
add_filter('acf/load_field/name=carhop_member', function ($field) {
$field['choices'] = [];
switch_to_blog(1);
$equipe_members = get_posts(array(
'post_type' => 'equipe',
'posts_per_page' => -1,
'orderby' => 'title',
'order' => 'ASC',
));
restore_current_blog();
foreach ($equipe_members as $equipe_member) {
$field['choices'][$equipe_member->ID] = $equipe_member->post_title;
}
return $field;
});

View File

@ -1,74 +0,0 @@
.author-card {
@apply grid w-full border border-primary p-6 mb-12 items-center;
grid-template-columns: min-content 1fr;
gap: 1rem;
transition: all 0.3s ease-in-out;
&:hover {
@apply translate-y-[-4px];
}
&__profile-picture {
@apply w-32 h-32 object-cover p-2 border border-primary;
img {
@apply w-full h-full object-cover;
filter: grayscale(100%);
}
&-placeholder {
@apply bg-carhop-green-100 flex items-center justify-center;
&:before {
content: '';
@apply block w-6 h-6 filter-primary;
background-image: url('../resources/img/icons/icon-losange.svg');
background-size: contain;
background-repeat: no-repeat !important;
background-position: center;
}
&--1n:before {
background-image: url('../resources/img/icons/icon-losange.svg');
}
&--2n:before {
background-image: url('../resources/img/icons/icon-rectangle-rotated.svg');
}
&--3n:before {
background-image: url('../resources/img/icons/icon-circle.svg');
}
&--4n:before {
background-image: url('../resources/img/icons/icon-rectangle-vertical.svg');
}
}
&-placeholder {
@apply w-full h-full bg-carhop-green-100 relative;
/* &:after {
@apply content-[''] block w-6 h-6 bg-carhop-green-700 rounded-full absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2;
} */
}
}
&__infos {
@apply w-full flex flex-col gap-y-2;
.author-card__name {
@apply text-2xl uppercase font-medium tracking-normal;
}
.author-card__articles-amount {
@apply text-primary font-normal 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;
}
}
}
&__description {
@apply col-span-2;
}
}

View File

@ -8,6 +8,17 @@ $profilePictureUrl = $profilePicture['url'] ?? '';
$profilePictureAlt = $profilePicture['alt'] ?? '';
$comity = get_field('comity', $author_id);
$articlesAmount = get_author_articles_amount($author_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);
$comity = get_field('comity', $carhop_member_id);
restore_current_blog();
}
?>
@ -98,7 +109,7 @@ $articlesAmount = get_author_articles_amount($author_id);
'ID' => $latestArticle[0]->ID,
'showCover' => true,
));
?>
<?php endif; ?>

View File

@ -7,6 +7,17 @@ $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);
restore_current_blog();
}
write_log($is_carhop_member);
$totalArticles = count_user_articles($ID, 'articles');
?>