File: /var/www/vhosts/greenclinic.kz/newsite/wp-content/themes/green-clinic/blocks/doctors.php
<?php
$list = get_sub_field('doctors_list');
$btn = get_sub_field('btn');
$btn_link = get_sub_field('btn_link');
?>
<div class="container">
<h2 class="section-title doctors-title wow animate__animated animate__fadeInLeft"><?php echo esc_html(the_sub_field('block_title')); ?></h2>
<div class="doctors-slider owl-carousel wow animate__animated animate__fadeInLeft">
<?php foreach($list as $list_item): ?>
<?php
$doc_id = $list_item['doctor']->ID;
$photo = get_field('photo', $doc_id);
if(empty($photo)){
$photo = '/wp-content/uploads/2024/02/doctor.webp';
}
?>
<div class="doctors-slider-item">
<div class="doctor-slide-wrapp">
<a class="doctor-slide-img" href="<?php the_permalink($doc_id); ?>"><img src="<?php echo $photo; ?>" alt="<?php the_field('name', $doc_id); ?>"></a>
<div class="doctor-slide-name"><a style="text-decoration: none;" href="<?php the_permalink($doc_id); ?>"><?php the_field('name', $doc_id); ?></a></div>
<div class="doctor-slide-profession"><?php the_field('speciality', $doc_id); ?></div>
<div class="doctor-slide-experience">
<?php
// Get the current language
$current_language = wpm_get_language();
// Output the appropriate translation based on the current language
if ($current_language == 'en') {
echo 'Experience:';
} elseif ($current_language == 'kz') {
echo 'Еңбек өтілі:';
} else {
echo 'Стаж:'; // Default to Russian or the original language
}
?>
<?php the_field('experience', $doc_id); ?></div>
</div>
</div>
<?php endforeach;?>
</div>
<?php if($btn): ?>
<div class="button__container">
<a href="<?php echo $btn_link; ?>">
<button class="yellow-button"><?php echo $btn; ?></button>
</a>
</div>
<?php endif ?>
</div>