FEAT Introducing component
This commit is contained in:
parent
8895ca48a0
commit
368111e1b9
31
template-parts/authors/card-author.php
Normal file
31
template-parts/authors/card-author.php
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
<?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);
|
||||
|
||||
$totalArticles = count_user_articles($ID, 'articles');
|
||||
?>
|
||||
|
||||
<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>
|
||||
<p class="author-card__articles-amount"><?php echo $totalArticles; ?> articles</p>
|
||||
</div>
|
||||
|
||||
<div class="author-card__description">
|
||||
<?php echo $description; ?>
|
||||
</div>
|
||||
</a>
|
||||
Loading…
Reference in New Issue
Block a user