Сайт Fakel Gym
https://fakelgym.cp.good-production.xyz/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
69 lines
2.6 KiB
69 lines
2.6 KiB
<?php
|
|
/**
|
|
* Блок с клубными картами
|
|
*/
|
|
|
|
// Получение полей ACF
|
|
$block_id = 'club-cards-' . $block['id'];
|
|
$class_name = 'club-cards-block';
|
|
if (!empty($block['className'])) {
|
|
$class_name .= ' ' . $block['className'];
|
|
}
|
|
if (!empty($block['align'])) {
|
|
$class_name .= ' align' . $block['align'];
|
|
}
|
|
|
|
if (!function_exists('get_club_cards_for_current_language')) {
|
|
function get_club_cards_for_current_language() {
|
|
$current_lang = pll_current_language();
|
|
|
|
$args = array(
|
|
'post_type' => 'club-card',
|
|
'posts_per_page' => -1,
|
|
'lang' => $current_lang,
|
|
'post_status' => 'publish'
|
|
);
|
|
|
|
return get_posts($args);
|
|
}
|
|
}
|
|
|
|
$cards = get_club_cards_for_current_language();
|
|
?>
|
|
|
|
<div id="<?php echo esc_attr($block_id); ?>" class="container mx-auto mt-[24px] <?php echo esc_attr($class_name); ?>">
|
|
<?php if ($cards): ?>
|
|
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-[24px]">
|
|
<?php foreach ($cards as $card): ?>
|
|
<div class="club-card rounded-[8px] overflow-hidden border transition-shadow ">
|
|
<?php if (has_post_thumbnail($card->ID)): ?>
|
|
<div class="aspect-video overflow-hidden">
|
|
<?php echo get_the_post_thumbnail($card->ID, 'medium', ['class' => 'w-full h-full object-cover']); ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<div class="p-[24px]">
|
|
<h3 class="text-[20px] font-semibold mb-[12px]">
|
|
<?php echo get_the_title($card->ID); ?>
|
|
</h3>
|
|
|
|
<?php if (get_the_excerpt($card->ID)): ?>
|
|
<div class="text-gray-600 mb-[16px]">
|
|
<?php echo get_the_excerpt($card->ID); ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
|
|
<div class="text-center">
|
|
<button data-modal="club-card"
|
|
data-card-id="<?php echo $card->ID; ?>"
|
|
class="inline-block px-[24px] py-[12px] bg-blue-500 text-white rounded-[6px] hover:bg-blue-600 transition-colors ">
|
|
Подробнее
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
</div>
|