FEATURE Introducing an author card component to be reused
This commit is contained in:
parent
ccd01b2d59
commit
f2e9870fd4
42
template-parts/cards/author-card.php
Normal file
42
template-parts/cards/author-card.php
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
$member_id = $args['member_id'];
|
||||
|
||||
$member_full_name = get_the_title($member_id);
|
||||
$member_thumbnail = get_field('profile_thumbnail', $member_id);
|
||||
$member_description = get_field('description', $member_id);
|
||||
$member_email = get_field('email', $member_id);
|
||||
|
||||
|
||||
?>
|
||||
<li class="comity-type__item author-card">
|
||||
<div class="author-card__profile-picture">
|
||||
<?php if ($member_thumbnail) : ?>
|
||||
<a href="<?php echo get_the_permalink($author->ID); ?>">
|
||||
<img 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>
|
||||
</a>
|
||||
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<h4 class="author-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>
|
||||
<?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">
|
||||
<div class="cta__icon">
|
||||
<?php $mail_svg_path = get_template_directory() . '/resources/img/icons/carhop-mail.svg';
|
||||
if (file_exists($mail_svg_path)) {
|
||||
echo file_get_contents($mail_svg_path);
|
||||
} ?>
|
||||
</div>
|
||||
Envoyer un email
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
</li>
|
||||
Loading…
Reference in New Issue
Block a user