FEATURE Handling author status and status label
This commit is contained in:
parent
20398a32d9
commit
7f6be681fe
|
|
@ -1,5 +1,6 @@
|
|||
<?php
|
||||
$ID = $args['ID'];
|
||||
$ID = $args['ID'] ?? get_the_ID();
|
||||
|
||||
$name = get_the_title($ID);
|
||||
$link = get_the_permalink($ID);
|
||||
$profilePicture = get_field('profile_thumbnail', $ID);
|
||||
|
|
@ -7,6 +8,23 @@ $profilePictureUrl = $profilePicture['url'] ?? '';
|
|||
$profilePictureAlt = $profilePicture['alt'] ?? '';
|
||||
$description = get_field('description', $ID);
|
||||
|
||||
$show_author_status = $args['show_author_status'] ?? false;
|
||||
$author_status = $args['author_status'] ?? 'author';
|
||||
$author_status_label = '';
|
||||
|
||||
switch ($author_status) {
|
||||
case 'main-author':
|
||||
$author_status_label = 'Auteur·e principal';
|
||||
break;
|
||||
case 'publication-director':
|
||||
$author_status_label = 'Directeur·e de publication';
|
||||
break;
|
||||
default:
|
||||
case 'author':
|
||||
$author_status_label = 'Auteur·e';
|
||||
break;
|
||||
}
|
||||
|
||||
$is_carhop_member = get_field('is_carhop_member', $ID);
|
||||
$carhop_member_id = get_field('carhop_member', $ID);
|
||||
|
||||
|
|
@ -32,6 +50,11 @@ if ($is_carhop_member && isset($carhop_member_id)) {
|
|||
</div>
|
||||
<div class="author-card__infos">
|
||||
<h3 class="author-card__name"><?php echo $name; ?></h3>
|
||||
<?php if ($show_author_status) : ?>
|
||||
<div class="author-card__author-status author-card__author-status--<?php echo $author_status; ?>">
|
||||
<?php echo $author_status_label; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user