introducing the card
This commit is contained in:
parent
153971ea26
commit
d34fee3701
58
template-components/artisans/card-artisans.css
Normal file
58
template-components/artisans/card-artisans.css
Normal file
|
|
@ -0,0 +1,58 @@
|
||||||
|
.card-artisans {
|
||||||
|
@apply bg-white rounded-lg shadowed;
|
||||||
|
&__thumbnail {
|
||||||
|
@apply w-full h-32 lg:h-48 object-cover rounded-t-xl;
|
||||||
|
}
|
||||||
|
&__inner {
|
||||||
|
@apply p-6;
|
||||||
|
}
|
||||||
|
&__title {
|
||||||
|
@apply !text-2xl font-bold text-patrimoine-sante-securite !my-0;
|
||||||
|
}
|
||||||
|
&__team-members {
|
||||||
|
@apply font-bold !my-0;
|
||||||
|
}
|
||||||
|
&__taxonomy-tags {
|
||||||
|
@apply flex flex-wrap gap-2 mt-4;
|
||||||
|
.taxonomy-tag {
|
||||||
|
@apply bg-patrimoine-sante-securite-light text-patrimoine-sante-securite rounded-lg text-sm px-3 py-1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&__adresse {
|
||||||
|
@apply font-normal underline-offset-4 inline-flex !mt-6 w-full;
|
||||||
|
&:before {
|
||||||
|
@apply inline-flex mr-3 h-6 w-6 bg-center bg-contain bg-no-repeat;
|
||||||
|
content: '';
|
||||||
|
background-image: url('../resources/img/Homegrade_repertoire-adresse.svg');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
&__phone {
|
||||||
|
@apply font-semibold underline-offset-4 inline-flex w-full;
|
||||||
|
&:before {
|
||||||
|
@apply inline-flex mr-3 h-6 w-6 bg-center bg-contain bg-no-repeat;
|
||||||
|
content: '';
|
||||||
|
background-image: url('../resources/img/Homegrade_repertoire-telephone.svg');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
&__email {
|
||||||
|
@apply text-primary underline font-semibold underline-offset-4 inline-flex w-full;
|
||||||
|
&:before {
|
||||||
|
@apply inline-flex mr-3 h-6 w-6 bg-center bg-contain bg-no-repeat;
|
||||||
|
content: '';
|
||||||
|
background-image: url('../resources/img/Homegrade_repertoire-mail.svg');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
&__website {
|
||||||
|
@apply text-primary underline font-semibold underline-offset-4 inline-flex w-full;
|
||||||
|
&:before {
|
||||||
|
@apply inline-flex mr-3 h-6 w-6 bg-center bg-contain bg-no-repeat;
|
||||||
|
content: '';
|
||||||
|
background-image: url('../resources/img/Homegrade_repertoire-site.svg');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.cta--read-more {
|
||||||
|
@apply mt-6;
|
||||||
|
}
|
||||||
|
}
|
||||||
65
template-components/artisans/card-artisans.php
Normal file
65
template-components/artisans/card-artisans.php
Normal file
|
|
@ -0,0 +1,65 @@
|
||||||
|
<?php
|
||||||
|
$postID = $args['post_ID'];
|
||||||
|
$post_thumbnail = $args['post_thumbnail'];
|
||||||
|
$post_title = $args['post_title'];
|
||||||
|
$post_permalink = get_the_permalink($postID);
|
||||||
|
$company_members = get_field('company_members', $postID);
|
||||||
|
$currentTaxonomy = $args['current_taxonomy'];
|
||||||
|
|
||||||
|
$taxonomyTerms = $currentTaxonomy === "elementsbatiments" ? get_the_terms($postID, 'elementsbatiments') : get_the_terms($postID, 'metiers');
|
||||||
|
|
||||||
|
|
||||||
|
$phoneNumber = get_field('phone_number', $postID);
|
||||||
|
$formattedPhoneNumber = preg_replace('/^(\+\d{2})(\d{3})(\d{2})(\d{2})(\d{2})$/', '$1 $2 $3 $4 $5', $phoneNumber);
|
||||||
|
$email = get_field('email', $postID);
|
||||||
|
$website = get_field('website', $postID);
|
||||||
|
|
||||||
|
$adresse = get_field('adresse', $postID);
|
||||||
|
write_log($adresse);
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
|
||||||
|
<article class="card-artisans card-post">
|
||||||
|
<?php echo $post_thumbnail ?>
|
||||||
|
<div class="card-artisans__inner">
|
||||||
|
|
||||||
|
<h2 class="card-artisans__title"><?php echo $post_title ?></h2>
|
||||||
|
|
||||||
|
<?php if ($company_members): ?>
|
||||||
|
<p class="card-artisans__team-members">
|
||||||
|
<?php foreach ($company_members as $key => $member) : ?>
|
||||||
|
<span><?php echo $member['first_name'] . ' ' . $member['last_name']; ?></span>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</p>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if ($taxonomyTerms): ?>
|
||||||
|
<div class="card-artisans__taxonomy-tags">
|
||||||
|
<?php foreach ($taxonomyTerms as $key => $term) : ?>
|
||||||
|
<span class="taxonomy-tag"><?php echo $term->name; ?></span>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?php if ($adresse): ?>
|
||||||
|
<p class="card-artisans__adresse"><?php echo $adresse['post_code'] . " " . $adresse['city'] ?></p>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<?php if ($phoneNumber): ?>
|
||||||
|
<a class="card-artisans__phone" href="tel:<?php echo $phoneNumber ?>"><?php echo $formattedPhoneNumber ?></a>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if ($email): ?>
|
||||||
|
<a class="card-artisans__email" href="mailto:<?php echo $email ?>"><?php echo $email ?></a>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if ($website): ?>
|
||||||
|
<?php $clean_website = str_replace(array('http://', 'https://'), '', $website); ?>
|
||||||
|
<a class="card-artisans__website" href="<?php echo $website ?>"><?php echo $clean_website ?></a>
|
||||||
|
<?php endif; ?>
|
||||||
|
<a href=" <?php echo get_the_permalink($postID) ?>" class="cta cta--read-more cta--with-arrow-button cta--streched ">
|
||||||
|
<span><?php echo __("En savoir plus", 'metiers-du-patirmoine-theme') ?></span>
|
||||||
|
<span class="sr-only"> <?php echo $post_title ?></span>
|
||||||
|
<img class="cta_arrow_button" src='<?php echo get_template_directory_uri() ?>/resources/img/graphic-assets/arrow-right-circle.svg' alt=''>
|
||||||
|
</a>
|
||||||
|
</article>
|
||||||
Loading…
Reference in New Issue
Block a user