+
+
+
+
+
+
+
+
+
Контакты
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/blocks/gallery-tabs/gallery-tabs.js b/blocks/gallery-tabs/gallery-tabs.js
index b07b20d..afe3a9e 100644
--- a/blocks/gallery-tabs/gallery-tabs.js
+++ b/blocks/gallery-tabs/gallery-tabs.js
@@ -12,23 +12,51 @@ function initGalleryBlock(blockId) {
const swipers = {};
let lightbox;
- function initSwiper(tabId) {
- if (swipers[tabId]) {
- swipers[tabId].destroy(true, true);
- }
+ function initAllSwipers() {
+ const tabs = container.querySelectorAll('.tab-button');
- swipers[tabId] = new Swiper(`#${blockId} #swiper-${tabId}`, {
- slidesPerView: 1.5,
- spaceBetween: 20,
- loop: true,
- centeredSlides: true,
- navigation: {
- nextEl: `#${blockId} #swiper-${tabId} .swiper-button-next`,
- prevEl: `#${blockId} #swiper-${tabId} .swiper-button-prev`,
- },
- on: {
- slideChange: function() {
- updateThumbnails(tabId, this.realIndex);
+ tabs.forEach(button => {
+ const tabId = button.getAttribute('data-tab');
+ const tabContent = container.querySelector(`#tab-${tabId}`);
+
+ if (tabContent && tabContent.querySelector('.swiper')) {
+ const wasHidden = tabContent.classList.contains('hidden');
+ if (wasHidden) {
+ tabContent.style.visibility = 'hidden';
+ tabContent.style.position = 'absolute';
+ tabContent.classList.remove('hidden');
+ tabContent.classList.add('block');
+ }
+
+ if (swipers[tabId]) {
+ swipers[tabId].destroy(true, true);
+ }
+
+ swipers[tabId] = new Swiper(`#${blockId} #swiper-${tabId}`, {
+ slidesPerView: 1.5,
+ spaceBetween: 20,
+ loop: true,
+ centeredSlides: true,
+ grabCursor: true,
+ observer: true,
+ observeParents: true,
+ watchSlidesProgress: true,
+ navigation: {
+ nextEl: `#${blockId} #swiper-${tabId} .swiper-button-next`,
+ prevEl: `#${blockId} #swiper-${tabId} .swiper-button-prev`,
+ },
+ on: {
+ slideChange: function() {
+ updateThumbnails(tabId, this.realIndex);
+ }
+ }
+ });
+
+ if (wasHidden) {
+ tabContent.style.visibility = '';
+ tabContent.style.position = '';
+ tabContent.classList.add('hidden');
+ tabContent.classList.remove('block');
}
}
});
@@ -57,7 +85,14 @@ function initGalleryBlock(blockId) {
});
}
- // Табы
+ initAllSwipers();
+
+ const activeTab = container.querySelector('.tab-button.active');
+ if (activeTab) {
+ const tabId = activeTab.getAttribute('data-tab');
+ initLightbox(tabId);
+ }
+
container.querySelectorAll('.tab-button').forEach(button => {
button.addEventListener('click', () => {
const tabId = button.getAttribute('data-tab');
@@ -73,17 +108,21 @@ function initGalleryBlock(blockId) {
content.classList.remove('block');
content.classList.add('hidden');
});
- container.querySelector(`#tab-${tabId}`).classList.remove('hidden');
- container.querySelector(`#tab-${tabId}`).classList.add('block');
- setTimeout(() => {
- initSwiper(tabId);
- initLightbox(tabId);
- }, 100);
+ const targetTab = container.querySelector(`#tab-${tabId}`);
+ targetTab.classList.remove('hidden');
+ targetTab.classList.add('block');
+
+ if (swipers[tabId]) {
+ requestAnimationFrame(() => {
+ swipers[tabId].update();
+ });
+ }
+
+ initLightbox(tabId);
});
});
- // Thumbnails
container.addEventListener('click', (e) => {
if (e.target.closest('.thumbnail')) {
const thumbnail = e.target.closest('.thumbnail');
@@ -98,13 +137,4 @@ function initGalleryBlock(blockId) {
updateThumbnails(tabId, index);
}
});
-
- const firstTab = container.querySelector('.tab-button.active');
- if (firstTab) {
- const tabId = firstTab.getAttribute('data-tab');
- setTimeout(() => {
- initSwiper(tabId);
- initLightbox(tabId);
- }, 100);
- }
}
\ No newline at end of file
diff --git a/blocks/gallery-tabs/gallery-tabs.php b/blocks/gallery-tabs/gallery-tabs.php
index ea4f985..1a49d96 100644
--- a/blocks/gallery-tabs/gallery-tabs.php
+++ b/blocks/gallery-tabs/gallery-tabs.php
@@ -1,136 +1,86 @@
[
- 'title' => 'Зона ресепшен',
- 'images' => [
- [
- 'src' => 'https://placehold.co/800x600/4a5568/ffffff?text=Ресепшен+1',
- 'thumb' => 'https://placehold.co/150x100/4a5568/ffffff?text=Р1',
- 'alt' => 'Ресепшен 1'
- ],
- [
- 'src' => 'https://placehold.co/800x600/2d3748/ffffff?text=Ресепшен+2',
- 'thumb' => 'https://placehold.co/150x100/2d3748/ffffff?text=Р2',
- 'alt' => 'Ресепшен 2'
- ],
- [
- 'src' => 'https://placehold.co/800x600/1a202c/ffffff?text=Ресепшен+3',
- 'thumb' => 'https://placehold.co/150x100/1a202c/ffffff?text=Р3',
- 'alt' => 'Ресепшен 3'
- ],
- [
- 'src' => 'https://placehold.co/800x600/718096/ffffff?text=Ресепшен+4',
- 'thumb' => 'https://placehold.co/150x100/718096/ffffff?text=Р4',
- 'alt' => 'Ресепшен 4'
- ]
- ]
- ],
- 'gym' => [
- 'title' => 'Зона тренажерного зала',
- 'images' => [
- [
- 'src' => 'https://placehold.co/800x600/dc2626/ffffff?text=Тренажёрный+1',
- 'thumb' => 'https://placehold.co/150x100/dc2626/ffffff?text=Т1',
- 'alt' => 'Тренажерный зал 1'
- ],
- [
- 'src' => 'https://placehold.co/800x600/b91c1c/ffffff?text=Тренажёрный+2',
- 'thumb' => 'https://placehold.co/150x100/b91c1c/ffffff?text=Т2',
- 'alt' => 'Тренажерный зал 2'
- ],
- [
- 'src' => 'https://placehold.co/800x600/991b1b/ffffff?text=Тренажёрный+3',
- 'thumb' => 'https://placehold.co/150x100/991b1b/ffffff?text=Т3',
- 'alt' => 'Тренажерный зал 3'
- ],
- [
- 'src' => 'https://placehold.co/800x600/7f1d1d/ffffff?text=Тренажёрный+4',
- 'thumb' => 'https://placehold.co/150x100/7f1d1d/ffffff?text=Т4',
- 'alt' => 'Тренажерный зал 4'
- ],
- [
- 'src' => 'https://placehold.co/800x600/ef4444/ffffff?text=Тренажёрный+5',
- 'thumb' => 'https://placehold.co/150x100/ef4444/ffffff?text=Т5',
- 'alt' => 'Тренажерный зал 5'
- ]
- ]
- ],
- 'group' => [
- 'title' => 'Залы для групповых тренировок',
- 'images' => [
- [
- 'src' => 'https://placehold.co/800x600/059669/ffffff?text=Групповые+1',
- 'thumb' => 'https://placehold.co/150x100/059669/ffffff?text=Г1',
- 'alt' => 'Групповые тренировки 1'
- ],
- [
- 'src' => 'https://placehold.co/800x600/047857/ffffff?text=Групповые+2',
- 'thumb' => 'https://placehold.co/150x100/047857/ffffff?text=Г2',
- 'alt' => 'Групповые тренировки 2'
- ],
- [
- 'src' => 'https://placehold.co/800x600/065f46/ffffff?text=Групповые+3',
- 'thumb' => 'https://placehold.co/150x100/065f46/ffffff?text=Г3',
- 'alt' => 'Групповые тренировки 3'
- ]
- ]
- ]
-];
+$id = 'gallery-tabs-' . $block['id'];
+if ( ! empty($block['anchor'] ) ) {
+ $id = $block['anchor'];
+}
+
+$classes = 'block-gallery-tabs';
+if ( ! empty( $block['className'] ) ) {
+ $classes .= ' ' . $block['className'];
+}
+if ( ! empty( $block['align'] ) ) {
+ $classes .= ' align' . $block['align'];
+}
+
+$heading = get_field('heading');
+$slider_tabs = get_field('slider_tabs');
-$block_id = 'gallery-' . $block['id'];
?>
-
+
-
Галерея
-
- $tab): ?>
-
-
-
-
-
-
+
+
+
- $tab_data): ?>
-
-
-
-
-
- $image): ?>
-
-
-
+
+
+ $tab) : ?>
+
+
+
+
+
-
-
-
+
+
+
+ $tab) : ?>
+
+
+
+
+
+
+ $image) : ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/blocks/reviews-block/reviews-block.js b/blocks/reviews-block/reviews-block.js
index 2449ddc..bbf2e6e 100644
--- a/blocks/reviews-block/reviews-block.js
+++ b/blocks/reviews-block/reviews-block.js
@@ -12,16 +12,43 @@ function initReviewsBlock(blockId) {
const swipers = {};
let lightbox;
- function initSwiper(tabId) {
- if (swipers[tabId]) {
- swipers[tabId].destroy(true, true);
- }
+ function initAllSwipers() {
+ const tabs = container.querySelectorAll('.tab-button');
- swipers[tabId] = new Swiper(`#${blockId} #swiper-${tabId}`, {
- slidesPerView: 3,
- spaceBetween: 20,
- loop: true,
- centeredSlides: true,
+ tabs.forEach(button => {
+ const tabId = button.getAttribute('data-tab');
+ const tabContent = container.querySelector(`#tab-${tabId}`);
+
+ if (tabContent && tabContent.querySelector('.swiper')) {
+ const wasHidden = tabContent.classList.contains('hidden');
+ if (wasHidden) {
+ tabContent.style.visibility = 'hidden';
+ tabContent.style.position = 'absolute';
+ tabContent.classList.remove('hidden');
+ tabContent.classList.add('block');
+ }
+
+ if (swipers[tabId]) {
+ swipers[tabId].destroy(true, true);
+ }
+
+ swipers[tabId] = new Swiper(`#${blockId} #swiper-${tabId}`, {
+ slidesPerView: 'auto',
+ spaceBetween: 20,
+ loop: true,
+ centeredSlides: true,
+ observer: true,
+ observeParents: true,
+ watchSlidesProgress: true,
+ });
+
+ if (wasHidden) {
+ tabContent.style.visibility = '';
+ tabContent.style.position = '';
+ tabContent.classList.add('hidden');
+ tabContent.classList.remove('block');
+ }
+ }
});
}
@@ -64,8 +91,14 @@ function initReviewsBlock(blockId) {
});
}
+ initAllSwipers();
+
+ const activeTab = container.querySelector('.tab-button.active');
+ if (activeTab) {
+ const tabId = activeTab.getAttribute('data-tab');
+ initLightbox(tabId);
+ }
- // Табы
container.querySelectorAll('.tab-button').forEach(button => {
button.addEventListener('click', () => {
const tabId = button.getAttribute('data-tab');
@@ -81,24 +114,18 @@ function initReviewsBlock(blockId) {
content.classList.remove('block');
content.classList.add('hidden');
});
- container.querySelector(`#tab-${tabId}`).classList.remove('hidden');
- container.querySelector(`#tab-${tabId}`).classList.add('block');
- setTimeout(() => {
- initSwiper(tabId);
- initLightbox(tabId);
- }, 100);
+ const targetTab = container.querySelector(`#tab-${tabId}`);
+ targetTab.classList.remove('hidden');
+ targetTab.classList.add('block');
+
+ if (swipers[tabId]) {
+ requestAnimationFrame(() => {
+ swipers[tabId].update();
+ });
+ }
+
+ initLightbox(tabId);
});
});
-
-
-
- const firstTab = container.querySelector('.tab-button.active');
- if (firstTab) {
- const tabId = firstTab.getAttribute('data-tab');
- setTimeout(() => {
- initSwiper(tabId);
- initLightbox(tabId);
- }, 100);
- }
}
\ No newline at end of file
diff --git a/blocks/reviews-block/reviews-block.php b/blocks/reviews-block/reviews-block.php
index 63fffab..149cc8f 100644
--- a/blocks/reviews-block/reviews-block.php
+++ b/blocks/reviews-block/reviews-block.php
@@ -1,136 +1,153 @@
[
- 'title' => 'Отзывы Google',
- 'reviews' => [
- [
- 'src' => 'https://placehold.co/800x600/4f46e5/ffffff?text=Отзыв+Google+1',
- 'thumb' => 'https://placehold.co/300x200/4f46e5/ffffff?text=G1',
- 'alt' => 'Отзыв Google 1'
- ],
- [
- 'src' => 'https://placehold.co/800x600/7c3aed/ffffff?text=Отзыв+Google+2',
- 'thumb' => 'https://placehold.co/300x200/7c3aed/ffffff?text=G2',
- 'alt' => 'Отзыв Google 2'
- ],
- [
- 'src' => 'https://placehold.co/800x600/8b5cf6/ffffff?text=Отзыв+Google+3',
- 'thumb' => 'https://placehold.co/300x200/8b5cf6/ffffff?text=G3',
- 'alt' => 'Отзыв Google 3'
- ],
- [
- 'src' => 'https://placehold.co/800x600/a855f7/ffffff?text=Отзыв+Google+4',
- 'thumb' => 'https://placehold.co/300x200/a855f7/ffffff?text=G4',
- 'alt' => 'Отзыв Google 4'
- ]
- ]
- ],
- 'yandex' => [
- 'title' => 'Отзывы Яндекс',
- 'reviews' => [
- [
- 'src' => 'https://placehold.co/800x600/f59e0b/ffffff?text=Отзыв+Яндекс+1',
- 'thumb' => 'https://placehold.co/300x200/f59e0b/ffffff?text=Я1',
- 'alt' => 'Отзыв Яндекс 1'
- ],
- [
- 'src' => 'https://placehold.co/800x600/d97706/ffffff?text=Отзыв+Яндекс+2',
- 'thumb' => 'https://placehold.co/300x200/d97706/ffffff?text=Я2',
- 'alt' => 'Отзыв Яндекс 2'
- ],
- [
- 'src' => 'https://placehold.co/800x600/b45309/ffffff?text=Отзыв+Яндекс+3',
- 'thumb' => 'https://placehold.co/300x200/b45309/ffffff?text=Я3',
- 'alt' => 'Отзыв Яндекс 3'
- ]
- ]
- ],
- 'video' => [
- 'title' => 'Видеоотзывы',
- 'reviews' => [
- [
- 'src' => '/path/to/video1.mp4', // Путь к видеофайлу
- 'thumb' => 'https://placehold.co/300x200/b45309/ffffff?text=В1',
- 'alt' => 'Видеоотзыв 1',
- 'type' => 'video',
- 'video_type' => 'mp4' // Тип видео
- ],
- [
- 'src' => '/path/to/video2.webm',
- 'thumb' => 'https://placehold.co/300x200/b45309/ffffff?text=В2',
- 'alt' => 'Видеоотзыв 2',
- 'type' => 'video',
- 'video_type' => 'webm'
- ],
- [
- 'src' => '/path/to/video3.mov',
- 'thumb' => 'https://placehold.co/300x200/b45309/ffffff?text=В3',
- 'alt' => 'Видеоотзыв 3',
- 'type' => 'video',
- 'video_type' => 'mov'
- ]
- ]
- ]
-];
+$id = 'reviews-block-' . $block['id'];
+if ( ! empty($block['anchor'] ) ) {
+ $id = $block['anchor'];
+}
-$block_id = 'reviews-' . $block['id'];
+$classes = 'block-reviews-block';
+if ( ! empty( $block['className'] ) ) {
+ $classes .= ' ' . $block['className'];
+}
+if ( ! empty( $block['align'] ) ) {
+ $classes .= ' align' . $block['align'];
+}
+
+$heading = get_field('heading');
+$slider_tabs = get_field('slider_tabs');
+$slider_video_reviews = get_field('slider_video_reviews');
+$stars = get_field('stars');
?>
-
+
-
Отзывы клиентов
+
+
+
-
-
- $tab): ?>
-
-
+
+
+ $tab) : ?>
+
+
+
+
+
+
+
+
+
+
+ Видеоотзывы
-
+
-
-
- $tab_data): ?>
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Оценок:
+
+
-
+
+
+
+ $tab) : ?>
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/blocks/tiles-block/tiles-block.php b/blocks/tiles-block/tiles-block.php
new file mode 100644
index 0000000..f4bd5d9
--- /dev/null
+++ b/blocks/tiles-block/tiles-block.php
@@ -0,0 +1,62 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/footer.php b/footer.php
index 92172c1..7185f02 100644
--- a/footer.php
+++ b/footer.php
@@ -1,7 +1,7 @@
-
+
Время работы:
@@ -25,4 +25,3 @@
-/
\ No newline at end of file
diff --git a/functions/blocks.php b/functions/blocks.php
index 6c33df8..c2c5715 100644
--- a/functions/blocks.php
+++ b/functions/blocks.php
@@ -73,6 +73,21 @@ function register_acf_blocks() {
),
));
+ acf_register_block_type(array(
+ 'name' => 'tiles-block',
+ 'title' => __('Блок с плитками'),
+ 'description' => __('Блок с плитками'),
+ 'render_template' => 'template-parts/la-components/blocks/tiles-block/tiles-block.php',
+ 'category' => 'theme-blocks',
+ 'icon' => 'grid-view',
+ 'keywords' => array('плитки', 'карточки', 'tiles', 'cards'),
+ 'supports' => array(
+ 'align' => array('wide', 'full'),
+ 'anchor' => true,
+ 'customClassName' => true,
+ ),
+ ));
+
acf_register_block_type(array(
'name' => 'reviews-block',
'title' => __('Блок с отзывами'),