REFACTOR Moving the card into the components subfolder
This commit is contained in:
parent
00e6212bb8
commit
6d97d1db80
|
|
@ -1,42 +0,0 @@
|
||||||
<?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);
|
|
||||||
|
|
||||||
$tumbnailPosition = get_field('profile_thumbnail_position', $member_id) ?? '50%';
|
|
||||||
?>
|
|
||||||
<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 style="object-position: 50% <?php echo $tumbnailPosition; ?>%;" 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>
|
|
||||||
43
template-parts/components/cards/author-card.php
Normal file
43
template-parts/components/cards/author-card.php
Normal file
|
|
@ -0,0 +1,43 @@
|
||||||
|
<?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);
|
||||||
|
|
||||||
|
$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);
|
||||||
|
$profilePicture = get_field('profile_thumbnail', $carhop_member_id);
|
||||||
|
$profilePictureUrl = $profilePicture['url'] ?? '';
|
||||||
|
$profilePictureAlt = $profilePicture['alt'] ?? '';
|
||||||
|
restore_current_blog();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<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>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="author-card__description">
|
||||||
|
<?php echo $description; ?>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
Loading…
Reference in New Issue
Block a user