/home/bdqbpbxa/demo-subdomains/u-pod.goodface.com.ua/wp-content/themes/upod/single.php
<?php
get_header();
$lang = pll_current_language();
$where_button = 'where_button-' . $lang;
$where_button_obj = get_field($where_button, 'option');
?>
<section class="main-title -white-block -brand">
<div class="container">
<div class="main-title-block animation">
<div class="logo">
<img class="lazyload"
<?php
$main_brand_logo = get_field('main_brand_logo');
?>
src="<?php echo $main_brand_logo['url']?>"
srcset="<?php echo get_template_directory_uri();?>/assets/img/srcset.svg"
alt="<?php echo $main_brand_logo['alt']?>"
>
</div>
<h1 class="title title-2 mobile-1">
<?php echo do_shortcode(get_field('main_brand_title'))?>
</h1>
<p class="text text-1 mobile-1 -grey">
<?php the_field('main_brand_subtitle')?>
</p>
<a href="<?php echo $where_button_obj['url']?>" class="button -big">
<?php echo $where_button_obj['title']?>
</a>
</div>
</div>
</section>
<div class="brand-scroll-block scroll-block -white-block">
<div class="scroll-container animation">
<div class="scroll-box">
<?php
$main_brand_slider = get_field('main_brand_slider');
foreach($main_brand_slider as $item):
?>
<div class="img">
<img class="lazyload" src="<?php echo $item['url'];?>" srcset="<?php echo get_template_directory_uri();?>/assets/img/srcset.svg" alt="<?php echo $item['alt'];?>">
</div>
<?php
endforeach;
?>
</div>
</div>
</div>
<section class="catalog-section">
<div class="container animation">
<div class="title-box">
<h2 class="title title-2 mobile-3">
<?php
$brand_ID = get_the_ID();
$global_model = [];
$posts = get_posts( array(
'numberposts' => -1,
'post_type' => 'product',
'meta_query' => [
[
'key' => 'brand',
'value' => $brand_ID,
],
],
) );
foreach($posts as $post):
setup_postdata($post);
$brands = get_field('brand');
$global_model[] = $brands;
?>
<?php
endforeach;
wp_reset_postdata();
$count = array_count_values($global_model);
$count_num = $count[$brand_ID];
echo $count_num;
$models_brand_page_title = 'models_brand_page_title-' . $lang;
$models_brand_page_title_obj = get_field($models_brand_page_title, 'option');
$last_num = $count_num % 10;
if ($count_num != 11 && $last_num == 1) {
echo ' ' . $models_brand_page_title_obj['singular'] . '</br>';
} else if ($count_num != 12 && $count_num != 13 && $count_num != 14 && ($last_num == 2 || $last_num == 3 || $last_num == 4)) {
echo ' ' . $models_brand_page_title_obj['plural_1'] . '</br>';
} else {
echo ' ' . $models_brand_page_title_obj['plural_2'] . '</br>';
}
?>
<?php echo do_shortcode(get_field('brand_model_title'));?>
</h2>
</div>
<div class="accordion-block">
<div class="brand-catalog">
<div class="list">
<?php
$posts = get_posts( array(
'numberposts' => -1,
'post_type' => 'product',
'meta_query' => [
[
'key' => 'brand',
'value' => $brand_ID,
],
],
) );
foreach($posts as $post):
setup_postdata($post);
$product_characteristics = get_field('product_characteristics');
$count_of_puff = $product_characteristics['count_of_puff'];
$img_width = get_field('img_width');
?>
<div class="brand-product open-product-modal">
<div class="img <?php if($img_width == 'true') echo ' -fill'?>">
<?php
$product_img = get_field('product_img');
?>
<img class="lazyload" src="<?php echo $product_img['url']?>" srcset="<?php echo get_template_directory_uri();?>/assets/img/srcset.svg" alt="<?php echo $product_img['alt']?>">
</div>
<h5 class="name title title-4">
<?php the_field('product_name');?>
</h5>
<p class="description text text-3">
Количество затяжек <strong><?php echo $count_of_puff?></strong>
</p>
<p class="price text text-4">
<?php
$price_edit = 'price_edit-' . $lang;
$price_edit_obj = get_field($price_edit , 'option');
echo $price_edit_obj['prefix'] . ' ';
the_field('product_price');
echo ' ' . $price_edit_obj['valuta'];
?>
</p>
</div>
<?php
endforeach;
wp_reset_postdata();
?>
</div>
</div>
</div>
</div>
</section>
<article class="mission-section -white-block -brand">
<div class="container animation">
<div class="logo">
<?php
$main_brand_logo = get_field('main_brand_logo');
?>
<img class="lazyload"
srcset="<?php echo get_template_directory_uri();?>/assets/img/srcset.svg"
src="<?php echo $main_brand_logo['url'];?>"
alt="<?php echo $main_brand_logo['alt'];?>"
>
</div>
<div class="title-box">
<div class="title title-2 mobile-2">
<?php the_field('brand_description_text');?>
</div>
</div>
<div class="mission-section__img -version-3">
<?php
$brand_secription_phones_photo = get_field('brand_secription_phones_photo');
foreach($brand_secription_phones_photo as $key => $photo):
$value = ($key+1)/2;
$value_replaced = str_replace('.', '', $value);
?>
<div class="img parallax" data-enllax-ratio="0.<?php echo $value_replaced; ?>" data-enllax-type="foreground">
<img class="lazyload"
srcset="<?php echo get_template_directory_uri();?>/assets/img/srcset.svg"
src="<?php echo $photo['url'];?>"
alt="<?php echo $photo['alt'];?>">
</div>
<?php endforeach;?>
</div>
</div>
</article>
<section class="benefits-list-section -white-block">
<div class="container">
<ol class="benefits-list animation">
<?php
$brand_preferences = get_field('brand_preferences');
?>
<li class="benefits-item">
<div class="number title-4"
style="background: linear-gradient(93.24deg, #F7186D 0.55%, #FFBE41 50.84%, #D2F500 100.09%);">01
</div>
<h4 class="title title-4 mobile-4"><?php echo $brand_preferences['text_1']['title']?></h4>
<p class="text text-2">
<?php echo $brand_preferences['text_1']['text']?>
</p>
</li>
<li class="benefits-item">
<div class="number title-4"
style="background: linear-gradient(93.47deg, #18CFF7 0.45%, #5161E9 49.26%, #B500F5 100.15%);">02
</div>
<h4 class="title title-4 mobile-4"><?php echo $brand_preferences['text_1']['title']?></h4>
<p class="text text-2">
<?php echo $brand_preferences['text_1']['text']?>
</p>
</li>
<li class="benefits-item">
<div class="number title-4"
style="background: linear-gradient(95.58deg, #B8FF20 0%, #17BCAF 50.52%, #165CE3 100%);">03
</div>
<h4 class="title title-4 mobile-4"><?php echo $brand_preferences['text_1']['title']?></h4>
<p class="text text-2">
<?php echo $brand_preferences['text_1']['text']?>
</p>
</li>
</ol>
</div>
</section>
<section class="response-section">
<div class="container animation">
<div class="title-box">
<h2 class="title title-2 mobile-2">
<?php
echo do_shortcode(get_field('brand_review_title'));
?>
</h2>
</div>
<div class="swiper-container response-slider">
<div class="swiper-wrapper">
<?php
$slider_repeater = get_field('slider_repeater');
foreach($slider_repeater as $slide):
?>
<div class="swiper-slide">
<div class="slide-content">
<p class="text text-1 mobile-2">
<?php
echo $slide['text'];
?>
</p>
<div class="user">
<div class="img">
<img class="lazyload" srcset="<?php echo get_template_directory_uri();?>/assets/img/srcset.svg" src="<?php echo $slide['photo']['url'];?>" alt="<?php echo $slide['photo']['alt'];?>">
</div>
<div class="text-box">
<p class="name"><?php echo $slide['name'];?></p>
<p class="date"><?php echo $slide['date'];?></p>
</div>
</div>
</div>
</div>
<?php
endforeach;
?>
</div>
<div class="swiper-pagination"></div>
<div class="slider__arrow-block">
<div class="slider__arrow prev-response"></div>
<div class="slider__arrow next-response"></div>
</div>
</div>
</div>
</section>
<section class="video-section -white-block">
<div class="container animation">
<div class="title-box">
<h2 class="title title-2 mobile-2">
<?php the_field('brand_video_title');?>
</h2>
<p class="text text-1 mobile-1 -grey">
<?php the_field('brand_video_subtitle');?>
</p>
</div>
<div class="video-block">
<?php
$brand_video_list = get_field('brand_video_list');
foreach($brand_video_list as $item):
?>
<div class="video-box" data-src="<?php echo $item['link'];?>">
<img class="lazyload" srcset="<?php echo get_template_directory_uri();?>/assets/img/srcset.svg" src="<?php echo $item['preview']['url']?>" alt="<?php echo $item['preview']['alt']?>">
<div class="play-button">
<svg width="22" height="30" viewBox="0 0 22 30" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M2 26L18 15L2 4V26Z" fill="#0B0C0D"/>
<path fill-rule="evenodd" clip-rule="evenodd"
d="M0 0.197998L21.5303 15.0001L0 29.8021V0.197998ZM4 7.80212V22.198L14.4697 15.0001L4 7.80212Z"
fill="#0B0C0D"/>
</svg>
</div>
</div>
<?php
endforeach;
?>
</div>
</div>
</section>
<script>
const product_obj = [
<?php
$posts = get_posts( array(
'numberposts' => -1,
'post_type' => 'product',
'meta_query' => [
[
'key' => 'brand',
'value' => $brand_ID,
],
],
) );
foreach($posts as $post):
setup_postdata($post);
$product_img = get_field('product_img');
$where_buy = get_field('where_buy');
$where_buy_text_id = 'where_buy_text-' . $lang;
$where_buy_text = get_field($where_buy_text_id, 'option');
$product_name = get_field('product_name');
$product_taste = get_field('product_taste');
$img_width = get_field('img_width');
$product_characteristics_name = get_field('product_characteristics_name-' . $lang, 'option');
$product_characteristics = get_field('product_characteristics');
$price_edit = get_field('price_edit-' . $lang, 'option');
$models_brand_taste = get_field('models_brand_taste-' . $lang, 'option');
if ($where_buy){
$where_buy = true;
} else {
$where_buy = false;
}
?>
{
img: '<?php echo $product_img['url']?>',
img_alt: '<?php echo $product_img['alt']?>',
attention_condition: '<?php echo $where_buy?>',
attention_text: '<?php echo $where_buy_text?>',
name: '<?php echo $product_name;?>',
price: '<?php echo $price_edit['prefix'] . ' ' . get_field('product_price') . ' ' . $price_edit['valuta'];?>',
description: '<?php the_field('product_description');?>',
description: '<?php the_field('product_description');?>',
data_lang: '<?php echo $lang;?>',
data_one: '<?php echo $models_brand_taste['singular']?>',
data_two: '<?php echo $models_brand_taste['plural_1']?>',
data_more: '<?php echo $models_brand_taste['plural_2']?>',
taste_list: [<?php foreach($product_taste as $item) { echo "'" . $item['name'] . "', ";}?>],
count_of_puff_name: '<?php echo $product_characteristics_name['count_of_puff'];?>',
count_of_nikotin_name: '<?php echo $product_characteristics_name['count_of_nikotin'];?>',
size_name: '<?php echo $product_characteristics_name['size'];?>',
weight_name: '<?php echo $product_characteristics_name['weight'];?>',
capacity_name: '<?php echo $product_characteristics_name['capacity'];?>',
count_of_puff: '<?php echo $product_characteristics['count_of_puff'];?>',
count_of_nikotin: '<?php echo $product_characteristics['count_of_nikotin'];?>',
size: '<?php echo $product_characteristics['size'];?>',
weight: '<?php echo $product_characteristics['weight'];?>',
capacity: '<?php echo $product_characteristics['capacity'] . $product_characteristics_name['capacity_dat'];?>',
lang: '<?php echo $lang?>',
filled_img: '<?php if ($img_width == 'true') { echo 'true'; } else { echo 'false'; } ?>'
},
<?php
endforeach;
wp_reset_postdata();
?>
]
</script>
<div class="modal-wrapper hide product-modal">
<div class="modal-block">
<div class="modal">
<div class="modal-close-icon close-modal">
<img class="lazyload" srcset="<?php echo get_template_directory_uri();?>/assets/img/srcset.svg" src="<?php echo get_template_directory_uri();?>/assets/img/close-modal-icon.svg" alt="UPOD.com.ua">
</div>
<div class="modal-product-info-block">
<div class="img">
<img class="lazyload" srcset="<?php echo get_template_directory_uri();?>/assets/img/srcset.svg" src="<?php echo get_template_directory_uri();?>/assets/img/srcset.svg" alt="HQD Cuvie Plus - UPOD.com.ua">
</div>
<div class="modal-product-info">
<p class="name title title-4">
HQD Cuvie Plus
</p>
<p class="price text text-1">
от 200 грн
</p>
<p class="description text-3">
Представляет собой компактную одноразовую pod-систему от китайского производителя.
</p>
<ul class="tastes-list" data-lang="ru" data-one="вкус" data-two="вкуса" data-more="вкусов">
</ul>
<ul class="data-list">
</ul>
<a href="<?php echo $where_button_obj['url']?>" class="button">
<?php echo $where_button_obj['title']?>
</a>
</div>
</div>
</div>
</div>
</div>
<?php
get_footer();
?>