REFACTOR Moving the component
This commit is contained in:
parent
4d0912f964
commit
77fe8c8ec0
|
|
@ -1,151 +0,0 @@
|
|||
<?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'] ?? '';
|
||||
$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();
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
<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">
|
||||
|
||||
<div class="inner container">
|
||||
<div class="author-card__profile-picture">
|
||||
<div class="profile-picture-container">
|
||||
<?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="background-picture"></div>
|
||||
</div>
|
||||
|
||||
<div class="author-card__content">
|
||||
<p class="page--single-auteurs__subinfo sub-infos">
|
||||
<span class="data-type">Auteur·e</span>
|
||||
|
||||
<?php if ($articlesAmount) : ?>
|
||||
<span class="articles-amount">
|
||||
|
||||
<?php echo $articlesAmount; ?> articles
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
|
||||
</p>
|
||||
<h1 class="page--single-auteurs__title"><?php the_title(); ?></h1>
|
||||
<div class="infos">
|
||||
<p><?php echo $description; ?></p>
|
||||
<?php if ($comity) : ?>
|
||||
<p class="page--single-auteurs__comities-list">
|
||||
|
||||
<?php foreach ($comity as $comity_value) : ?>
|
||||
<?php
|
||||
$comities = get_field_object('comity');
|
||||
$comity_label = $comities['choices'][$comity_value] ?? null;
|
||||
|
||||
?>
|
||||
<?php if ($comity_label) : ?>
|
||||
<span class="page--single-auteurs__comity page--single-auteurs__comity--<?php echo $comity_value ?>"><?php echo $comity_label ?></span>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="page--single-auteurs__latest-publication">
|
||||
|
||||
<p>Dernière publication</p>
|
||||
<?php
|
||||
$latestArticle = get_posts(array(
|
||||
'post_type' => '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])) : ?>
|
||||
|
||||
<?php
|
||||
get_template_part('template-parts/dynamiques/article-card', null, array(
|
||||
'ID' => $latestArticle[0]->ID,
|
||||
'showCover' => true,
|
||||
));
|
||||
|
||||
?>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
<?php
|
||||
$authorArticles = get_posts(array(
|
||||
'post_type' => 'articles',
|
||||
'posts_per_page' => -1,
|
||||
'post__not_in' => array($latestArticle[0]->ID),
|
||||
'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();
|
||||
Loading…
Reference in New Issue
Block a user