From 54eb8e266ffe2f57afb812d18c8f78030562f62a Mon Sep 17 00:00:00 2001 From: GP_DEV Date: Sun, 1 Jun 2025 12:38:35 +0300 Subject: [PATCH] init --- blocks/club-cards-block/club-cards-block.php | 68 +++++ blocks/contacts-block/contacts-block.js | 110 ++++++++ blocks/contacts-block/contacts-block.php | 131 ++++++++++ blocks/gallery-tabs/gallery-tabs.js | 110 ++++++++ blocks/gallery-tabs/gallery-tabs.php | 136 ++++++++++ blocks/hero-block/hero-block.css | 26 ++ blocks/hero-block/hero-block.js | 45 ++++ blocks/hero-block/hero-block.php | 170 ++++++++++++ blocks/reviews-block/reviews-block.js | 104 ++++++++ blocks/reviews-block/reviews-block.php | 136 ++++++++++ footer.php | 25 ++ functions/blocks.php | 158 +++++++++++ functions/modals.php | 58 +++++ js/modals.js | 120 +++++++++ language-switcher.php | 201 ++++++++++++++ modals/modal-club-card.php | 90 +++++++ modals/modal-example.php | 33 +++ modals/modal-form.php | 3 + modals/modal-room.php | 261 +++++++++++++++++++ modals/modal-time.php | 13 + navigation-menu.php | 180 +++++++++++++ 21 files changed, 2178 insertions(+) create mode 100644 blocks/club-cards-block/club-cards-block.php create mode 100644 blocks/contacts-block/contacts-block.js create mode 100644 blocks/contacts-block/contacts-block.php create mode 100644 blocks/gallery-tabs/gallery-tabs.js create mode 100644 blocks/gallery-tabs/gallery-tabs.php create mode 100644 blocks/hero-block/hero-block.css create mode 100644 blocks/hero-block/hero-block.js create mode 100644 blocks/hero-block/hero-block.php create mode 100644 blocks/reviews-block/reviews-block.js create mode 100644 blocks/reviews-block/reviews-block.php create mode 100644 footer.php create mode 100644 functions/blocks.php create mode 100644 functions/modals.php create mode 100644 js/modals.js create mode 100644 language-switcher.php create mode 100644 modals/modal-club-card.php create mode 100644 modals/modal-example.php create mode 100644 modals/modal-form.php create mode 100644 modals/modal-room.php create mode 100644 modals/modal-time.php create mode 100644 navigation-menu.php diff --git a/blocks/club-cards-block/club-cards-block.php b/blocks/club-cards-block/club-cards-block.php new file mode 100644 index 0000000..20e5cf9 --- /dev/null +++ b/blocks/club-cards-block/club-cards-block.php @@ -0,0 +1,68 @@ + 'club-card', + 'posts_per_page' => -1, + 'lang' => $current_lang, + 'post_status' => 'publish' + ); + + return get_posts($args); +} + +$cards = get_club_cards_for_current_language(); +?> + +
+ +
+ +
+ ID)): ?> +
+ ID, 'medium', ['class' => 'w-full h-full object-cover']); ?> +
+ + +
+

+ ID); ?> +

+ + ID)): ?> +
+ ID); ?> +
+ + + +
+ +
+
+
+ +
+ +
\ No newline at end of file diff --git a/blocks/contacts-block/contacts-block.js b/blocks/contacts-block/contacts-block.js new file mode 100644 index 0000000..a5018da --- /dev/null +++ b/blocks/contacts-block/contacts-block.js @@ -0,0 +1,110 @@ + ymaps.ready(function () { + + var buildingCoordinates = [55.832659, 37.576118]; + +//Смещение карты, чтобы иконка была визуально по центру + var offsetCoefficient = 0.001; + + var mapCenter = [ + buildingCoordinates[0], + buildingCoordinates[1] - offsetCoefficient + ]; + + var myMap = new ymaps.Map('map', { + center: mapCenter, + zoom: 17, + controls: [] +}); + + // Отключаем все взаимодействия с картой + myMap.behaviors.disable(['scrollZoom', 'drag', 'multiTouch', 'dblClickZoom']); + + var svgIcon = '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + ''; + + + var iconSize; + var iconOffset; + + if (window.innerWidth <= 768) { + + iconSize = [73, 88]; + iconOffset = [-36, -87]; +} else { + + iconSize = [146, 175]; + iconOffset = [-73, -174]; +} + + + var myPlacemark = new ymaps.Placemark( + buildingCoordinates, +{hintContent: '', balloonContent: ''}, +{ + + iconLayout: 'default#imageWithContent', + iconImageHref: 'data:image/svg+xml;charset=UTF-8,' + encodeURIComponent(svgIcon), + iconImageSize: iconSize, + iconImageOffset: iconOffset, + hideIconOnBalloonOpen: false +} + ); + + + myMap.panes.get('ground').getElement().style.filter = 'grayscale(100%)'; + + + myMap.geoObjects.add(myPlacemark); + + + var isMapInteractive = false; + var mapElement = document.getElementById('map'); + + function activateMap(e) { + if (!isMapInteractive) { + myMap.behaviors.enable(['scrollZoom', 'drag', 'multiTouch', 'dblClickZoom']); + isMapInteractive = true; + + setTimeout(function () { + document.addEventListener('click', deactivateMap); + document.addEventListener('touchend', deactivateMap); +}, 100); + + e.stopPropagation(); +} +} + + function deactivateMap(e) { + var target = e.target; + + if (e.type === 'touchend' || e.changedTouches || e.changedTouches[0]) { + var touch = e.changedTouches[0]; + target = document.elementFromPoint(touch.clientX, touch.clientY); +} + + if (!mapElement.contains(target)) { + + myMap.behaviors.disable(['scrollZoom', 'drag', 'multiTouch', 'dblClickZoom']); + isMapInteractive = false; + + + document.removeEventListener('click', deactivateMap); + document.removeEventListener('touchend', deactivateMap); +} +} + + mapElement.addEventListener('click', activateMap); + mapElement.addEventListener('touchstart', activateMap); +}); diff --git a/blocks/contacts-block/contacts-block.php b/blocks/contacts-block/contacts-block.php new file mode 100644 index 0000000..0ab9eb1 --- /dev/null +++ b/blocks/contacts-block/contacts-block.php @@ -0,0 +1,131 @@ + + + + +
+ +
+
+
+
+ + + + + + + + + + +
+ + Свяжитесь с нами +
+
+

+ Контакты

+
+

Номер телефона:

+ + +
+
+

Головной офис:

+
+ +
+
+
+

E-mail:

+ +
+
+
+
+
+ + +
\ No newline at end of file diff --git a/blocks/gallery-tabs/gallery-tabs.js b/blocks/gallery-tabs/gallery-tabs.js new file mode 100644 index 0000000..b07b20d --- /dev/null +++ b/blocks/gallery-tabs/gallery-tabs.js @@ -0,0 +1,110 @@ +document.addEventListener('DOMContentLoaded', function() { + document.querySelectorAll('.gallery-block').forEach(function(block) { + const blockId = block.getAttribute('data-gallery-id'); + initGalleryBlock(blockId); + }); +}); + +function initGalleryBlock(blockId) { + const container = document.getElementById(blockId); + if (!container) return; + + const swipers = {}; + let lightbox; + + function initSwiper(tabId) { + if (swipers[tabId]) { + swipers[tabId].destroy(true, true); + } + + 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); + } + } + }); + } + + function initLightbox(tabId) { + if (lightbox) { + lightbox.destroy(); + } + + lightbox = GLightbox({ + selector: `#${blockId} #tab-${tabId} .glightbox` + }); + } + + function updateThumbnails(tabId, activeIndex) { + const thumbnails = container.querySelectorAll(`#tab-${tabId} .thumbnail`); + thumbnails.forEach((thumb, index) => { + if (index === activeIndex) { + thumb.classList.add('active', '!border-blue-500'); + thumb.classList.remove('border-transparent'); + } else { + thumb.classList.remove('active', '!border-blue-500'); + thumb.classList.add('border-transparent'); + } + }); + } + + // Табы + container.querySelectorAll('.tab-button').forEach(button => { + button.addEventListener('click', () => { + const tabId = button.getAttribute('data-tab'); + + container.querySelectorAll('.tab-button').forEach(btn => { + btn.classList.remove('active', 'underline'); + btn.classList.add('bg-gray-100'); + }); + button.classList.add('active', 'underline'); + button.classList.remove('bg-gray-100'); + + container.querySelectorAll('.tab-content').forEach(content => { + 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); + }); + }); + + // Thumbnails + container.addEventListener('click', (e) => { + if (e.target.closest('.thumbnail')) { + const thumbnail = e.target.closest('.thumbnail'); + const index = parseInt(thumbnail.getAttribute('data-index')); + const activeTab = container.querySelector('.tab-content.block'); + const tabId = activeTab.id.replace('tab-', ''); + + if (swipers[tabId]) { + swipers[tabId].slideToLoop(index); + } + + 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 new file mode 100644 index 0000000..ea4f985 --- /dev/null +++ b/blocks/gallery-tabs/gallery-tabs.php @@ -0,0 +1,136 @@ + [ + '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' + ] + ] + ] +]; + +$block_id = 'gallery-' . $block['id']; +?> + + + diff --git a/blocks/hero-block/hero-block.css b/blocks/hero-block/hero-block.css new file mode 100644 index 0000000..17700ac --- /dev/null +++ b/blocks/hero-block/hero-block.css @@ -0,0 +1,26 @@ +.inverted-radius-wrapper:before { + content: ''; + display: block; + width: 40px; + height: 25px; + background-color: transparent; + border-radius: 0 0 0 25px; + box-shadow: calc(15px * -0.5) calc(15px * 0.5) 0 0 #f9f9f9; + position: absolute; + z-index: -1; + left: -1px; + bottom: 100%; +} +.inverted-radius-wrapper:after { + content: ''; + display: block; + width: 40px; + height: 25px; + background-color: transparent; + border-radius: 0 0 0 25px; + box-shadow: calc(15px * -0.5) calc(15px * 0.5) 0 0 #f9f9f9; + position: absolute; + z-index: -1; + left: calc(100% - 1px); + bottom: 0; +} \ No newline at end of file diff --git a/blocks/hero-block/hero-block.js b/blocks/hero-block/hero-block.js new file mode 100644 index 0000000..d134d49 --- /dev/null +++ b/blocks/hero-block/hero-block.js @@ -0,0 +1,45 @@ +document.addEventListener('DOMContentLoaded', function() { + const heroBlocks = document.querySelectorAll('.hero-block'); + + heroBlocks.forEach(function(block) { + const swiperContainer = block.querySelector('.swiper'); + + if (!swiperContainer) return; + + const swiper = new Swiper(swiperContainer, { + slidesPerView: 1, + loop: true, + grabCursor: true, + on: { + slideChange: function () { + const realIndex = this.realIndex; + const paginationItems = block.querySelectorAll('.pagination-item'); + + paginationItems.forEach((item, index) => { + const line = item.querySelector('.pagination-line'); + const text = item.querySelector('.slide-text'); + + if (index === realIndex) { + item.className = 'pagination-item flex-[2] cursor-pointer transition-all '; + line.className = 'pagination-line bg-[#222] h-[2px] rounded-[30px] transition-colors '; + text.className = 'slide-text mt-[10px] text-[14px] text-[#222] font-[600] opacity-100 transition-opacity '; + } else { + item.className = 'pagination-item flex-1 cursor-pointer transition-all '; + line.className = 'pagination-line bg-[#e0e0e0] h-[2px] rounded-[30px] transition-colors '; + text.className = 'slide-text mt-[10px] text-[14px] text-[#222] font-[600] opacity-0 transition-opacity '; + } + }); + } + } + }); + + // Навигация + block.querySelector('.custom-prev')?.addEventListener('click', () => swiper.slidePrev()); + block.querySelector('.custom-next')?.addEventListener('click', () => swiper.slideNext()); + + // Пагинация + block.querySelectorAll('.pagination-item').forEach((item, index) => { + item.addEventListener('click', () => swiper.slideToLoop(index)); + }); + }); +}); \ No newline at end of file diff --git a/blocks/hero-block/hero-block.php b/blocks/hero-block/hero-block.php new file mode 100644 index 0000000..c675967 --- /dev/null +++ b/blocks/hero-block/hero-block.php @@ -0,0 +1,170 @@ + $slide) { + $image_url = ''; + if (!empty($slide['image']) && is_array($slide['image'])) { + $image_url = $slide['image']['url'] ?? ''; + } + + $slides[] = [ + 'number' => sprintf('%02d', $index + 1), + 'title' => $slide['text'] ?? '', + 'img' => $image_url + ]; + } +} + + +?> + +
+
+
+ + +

+ + + +

+ +

+ +

+ + + +
+ +
+

+ +

+

+ +

+
+
+
+ +
+
+
+ $slide): ?> +
+ + <?php echo esc_attr($slide['title']); ?> + +
+ +
+
+ +
+ + +
+
+
+ +
+ $slide): ?> +
+
+
+ . + +
+
+ +
+
+ + + + diff --git a/blocks/reviews-block/reviews-block.js b/blocks/reviews-block/reviews-block.js new file mode 100644 index 0000000..2449ddc --- /dev/null +++ b/blocks/reviews-block/reviews-block.js @@ -0,0 +1,104 @@ +document.addEventListener('DOMContentLoaded', function() { + document.querySelectorAll('.reviews-block').forEach(function(block) { + const blockId = block.getAttribute('data-reviews-id'); + initReviewsBlock(blockId); + }); +}); + +function initReviewsBlock(blockId) { + const container = document.getElementById(blockId); + if (!container) return; + + const swipers = {}; + let lightbox; + + function initSwiper(tabId) { + if (swipers[tabId]) { + swipers[tabId].destroy(true, true); + } + + swipers[tabId] = new Swiper(`#${blockId} #swiper-${tabId}`, { + slidesPerView: 3, + spaceBetween: 20, + loop: true, + centeredSlides: true, + }); + } + + function initLightbox(tabId) { + if (lightbox) { + lightbox.destroy(); + } + + lightbox = GLightbox({ + selector: `#${blockId} #tab-${tabId} .glightbox`, + touchNavigation: true, + loop: true, + autoplayVideos: false, + videosWidth: '90vw', + videosHeight: '80vh', + plyr: { + css: 'https://cdn.plyr.io/3.7.8/plyr.css', + js: 'https://cdn.plyr.io/3.7.8/plyr.js', + config: { + ratio: '16:9', + fullscreen: { enabled: true, fallback: true, iosNative: true }, + controls: [ + 'play-large', + 'play', + 'progress', + 'current-time', + 'duration', + 'mute', + 'volume', + 'fullscreen' + ] + } + }, + onOpen: () => { + console.log('видео открыли'); + }, + onClose: () => { + console.log('видео закрыли'); + } + }); + } + + + // Табы + container.querySelectorAll('.tab-button').forEach(button => { + button.addEventListener('click', () => { + const tabId = button.getAttribute('data-tab'); + + container.querySelectorAll('.tab-button').forEach(btn => { + btn.classList.remove('active', 'underline'); + btn.classList.add('bg-gray-100'); + }); + button.classList.add('active', 'underline'); + button.classList.remove('bg-gray-100'); + + container.querySelectorAll('.tab-content').forEach(content => { + 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 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 new file mode 100644 index 0000000..63fffab --- /dev/null +++ b/blocks/reviews-block/reviews-block.php @@ -0,0 +1,136 @@ + [ + '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' + ] + ] + ] +]; + +$block_id = 'reviews-' . $block['id']; +?> + +
+
+

Отзывы клиентов

+ + +
+ $tab): ?> + + +
+
+ + + $tab_data): ?> + + +
\ No newline at end of file diff --git a/footer.php b/footer.php new file mode 100644 index 0000000..c704fc8 --- /dev/null +++ b/footer.php @@ -0,0 +1,25 @@ + +
+
+
+ Время работы: + +
+
+
© 2025 fakelgym.ru. Все права защищены.
+
Политика Конфиденциальности
+
+ + + +
+
+
+
diff --git a/functions/blocks.php b/functions/blocks.php new file mode 100644 index 0000000..6c33df8 --- /dev/null +++ b/functions/blocks.php @@ -0,0 +1,158 @@ + 'hero-block', + 'title' => __('Hero Block'), + 'description' => __('Заглавный блок со слайдером'), + 'render_template' => 'template-parts/la-components/blocks/hero-block/hero-block.php', + 'category' => 'theme-blocks', + 'icon' => 'cover-image', + 'keywords' => array('hero', 'banner', 'заголовок', 'слайдер'), + 'supports' => array( + 'align' => array('wide', 'full'), + 'anchor' => true, + 'customClassName' => true, + ), + 'enqueue_assets' => function() { + wp_enqueue_script( + 'hero-block-js', + get_template_directory_uri() . '/template-parts/la-components/blocks/hero-block/hero-block.js', + ['jquery'], + '1.0.0', + true + ); + + wp_enqueue_style( + 'hero-block-css', + get_template_directory_uri() . '/template-parts/la-components/blocks/hero-block/hero-block.css', + [], + '1.0.0' + ); + } + )); + + acf_register_block_type(array( + 'name' => 'contacts-block', + 'title' => __('Блок с контактами'), + 'description' => __('Блок с контактами>'), + 'render_template' => 'template-parts/la-components/blocks/contacts-block/contacts-block.php', + 'category' => 'theme-blocks', + 'icon' => 'cover-image', + 'keywords' => array('контакты', 'contacts', 'адрес'), + 'supports' => array( + 'align' => array('wide', 'full'), + 'anchor' => true, + 'customClassName' => true, + ), + 'enqueue_assets' => function() { + wp_enqueue_script( + 'contacts-block-js', + get_template_directory_uri() . '/template-parts/la-components/blocks/contacts-block/contacts-block.js', + ['jquery'], + '1.0.0', + true + ); + } + )); + + + acf_register_block_type(array( + 'name' => 'club-cards-block', + 'title' => __('Блок с клубными картами'), + 'description' => __('Блок с клубными картами для текущего языка'), + 'render_template' => 'template-parts/la-components/blocks/club-cards-block/club-cards-block.php', + 'category' => 'theme-blocks', + 'icon' => 'id-alt', + 'keywords' => array('карты', 'клуб', 'cards', 'club'), + 'supports' => array( + 'align' => array('wide', 'full'), + 'anchor' => true, + 'customClassName' => true, + ), + )); + + acf_register_block_type(array( + 'name' => 'reviews-block', + 'title' => __('Блок с отзывами'), + 'description' => __('Блок с отзывами'), + 'render_template' => 'template-parts/la-components/blocks/reviews-block/reviews-block.php', + 'category' => 'theme-blocks', + 'icon' => 'cover-image', + 'keywords' => array('отзывы', 'видеоотзывы', 'reviews'), + 'supports' => array( + 'align' => array('wide', 'full'), + 'anchor' => true, + 'customClassName' => true, + ), + 'enqueue_assets' => function() { + wp_enqueue_script( + 'reviews-block-js', + get_template_directory_uri() . '/template-parts/la-components/blocks/reviews-block/reviews-block.js', + ['jquery'], + '1.0.0', + true + ); + } + )); + + + acf_register_block_type(array( + 'name' => 'gallery-tabs', + 'title' => __('Галерея с табами'), + 'description' => __('Галерея с табами, слайдером и лайтбоксом'), + 'render_template' => 'template-parts/la-components/blocks/gallery-tabs/gallery-tabs.php', + 'category' => 'theme-blocks', + 'icon' => 'images-alt2', + 'keywords' => array('gallery', 'tabs', 'slider', 'галерея', 'слайдер'), + 'supports' => array( + 'align' => array('wide', 'full'), + 'anchor' => true, + 'customClassName' => true, + ), + 'enqueue_assets' => function() { + + wp_enqueue_style( + 'glightbox-css', + 'https://cdnjs.cloudflare.com/ajax/libs/glightbox/3.2.0/css/glightbox.min.css', + [], + '3.2.0' + ); + + wp_enqueue_script( + 'glightbox-js', + 'https://cdnjs.cloudflare.com/ajax/libs/glightbox/3.2.0/js/glightbox.min.js', + [], + '3.2.0', + true + ); + + + wp_enqueue_script( + 'gallery-tabs-js', + get_template_directory_uri() . '/template-parts/la-components/blocks/gallery-tabs/gallery-tabs.js', + ['swiper-js', 'glightbox-js'], + '1.0.0', + true + ); + } + )); + } +} +add_action('acf/init', 'register_acf_blocks'); + + +function register_custom_block_category($categories, $post) { + return array_merge( + $categories, + array( + array( + 'slug' => 'theme-blocks', + 'title' => __('Блоки темы'), + 'icon' => 'admin-customizer', + ), + ) + ); +} +add_filter('block_categories_all', 'register_custom_block_category', 10, 2); \ No newline at end of file diff --git a/functions/modals.php b/functions/modals.php new file mode 100644 index 0000000..2dc2234 --- /dev/null +++ b/functions/modals.php @@ -0,0 +1,58 @@ + + + + + + \ No newline at end of file diff --git a/js/modals.js b/js/modals.js new file mode 100644 index 0000000..ceaf135 --- /dev/null +++ b/js/modals.js @@ -0,0 +1,120 @@ +document.addEventListener('DOMContentLoaded', function() { + window.ModalSystem = { + overlay: null, + content: null, + container: null, + closeBtn: null, + isOpen: false, + currentModal: null, + + init: function() { + this.overlay = document.getElementById('modal-overlay'); + if (!this.overlay) return; + + this.content = document.getElementById('modal-content'); + this.container = this.overlay.querySelector('.bg-white'); + this.closeBtn = document.getElementById('modal-close'); + + this.bindEvents(); + }, + bindEvents: function() { + if (this.closeBtn) { + this.closeBtn.addEventListener('click', () => this.close()); + } + this.overlay.addEventListener('click', (e) => { + if (e.target === this.overlay) { + this.close(); + } + }); + + document.addEventListener('keydown', (e) => { + if (e.key === 'Escape' && this.isOpen) { + this.close(); + } + }); + + document.addEventListener('click', (e) => { + const modalTrigger = e.target.closest('[data-modal]'); + if (modalTrigger) { + e.preventDefault(); + const modalName = modalTrigger.getAttribute('data-modal'); + this.open(modalName); + } + }); + + document.addEventListener('click', (e) => { + if (e.target.closest('[data-modal-close]')) { + e.preventDefault(); + this.close(); + } + }); + }, + + + open: function(modalName) { + if (this.isOpen) { + this.close(); + } + + const template = document.getElementById(`modal-template-${modalName}`); + if (!template) { + console.error(`модальное окно ${modalName} не найдено`); + return; + } + + this.currentModal = modalName; + this.content.innerHTML = template.innerHTML; + this.show(); + }, + + show: function() { + + this.overlay.classList.remove('opacity-0', 'invisible'); + this.overlay.classList.add('opacity-100', 'visible'); + + + setTimeout(() => { + this.container.classList.remove('scale-90'); + this.container.classList.add('scale-100'); + }, 10); + + this.isOpen = true; + + setTimeout(() => { + this.closeBtn.focus(); + }, 350); + }, + + close: function() { + if (!this.isOpen) return; + + this.container.classList.remove('scale-100'); + this.container.classList.add('scale-90'); + + this.overlay.classList.remove('opacity-100', 'visible'); + this.overlay.classList.add('opacity-0', 'invisible'); + + this.isOpen = false; + this.currentModal = null; + + }, + + + getState: function() { + return { + isOpen: this.isOpen, + currentModal: this.currentModal + }; + } + }; + + ModalSystem.init(); + + window.openModal = function(modalName) { + ModalSystem.open(modalName); + }; + + window.closeModal = function() { + ModalSystem.close(); + }; +}); \ No newline at end of file diff --git a/language-switcher.php b/language-switcher.php new file mode 100644 index 0000000..e30482f --- /dev/null +++ b/language-switcher.php @@ -0,0 +1,201 @@ + + + + +
+
+ 'name')); + $lang_slugs = pll_languages_list(array('fields' => 'slug')); + $lang_index = array_search($lang_slug, $lang_slugs); + if ($lang_index !== false && isset($lang_names[$lang_index])) { + $lang_name = $lang_names[$lang_index]; + } else { + $lang_name = strtoupper($lang_slug); + } + } else { + $lang_name = strtoupper($lang_slug); + } + + echo sprintf( + '%s', + esc_url($lang_url), + esc_attr($class), + esc_attr($lang_slug), + esc_html($lang_name) + ); + } + } + ?> +
+ + \ No newline at end of file diff --git a/modals/modal-club-card.php b/modals/modal-club-card.php new file mode 100644 index 0000000..0caf314 --- /dev/null +++ b/modals/modal-club-card.php @@ -0,0 +1,90 @@ + +
+
+

+ Заказать клубную карту +

+ +
+
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+
+ +
+ + +
+
+
diff --git a/modals/modal-example.php b/modals/modal-example.php new file mode 100644 index 0000000..b5829c4 --- /dev/null +++ b/modals/modal-example.php @@ -0,0 +1,33 @@ + +
+
+

О нашей компании 2

+ +
+

+ Мы работаем на рынке более 10 лет и знаем, как решать самые сложные задачи наших клиентов. +

+ +

+ Наша команда состоит из опытных специалистов, которые постоянно совершенствуют свои навыки. +

+ +
+

Наши преимущества:

+
    +
  • • Высокое качество работ
  • +
  • • Соблюдение сроков
  • +
  • • Индивидуальный подход
  • +
  • • Конкурентные цены
  • +
+
+
+ +
+ +
+
+
\ No newline at end of file diff --git a/modals/modal-form.php b/modals/modal-form.php new file mode 100644 index 0000000..c385d9f --- /dev/null +++ b/modals/modal-form.php @@ -0,0 +1,3 @@ + diff --git a/modals/modal-room.php b/modals/modal-room.php new file mode 100644 index 0000000..71c2fa8 --- /dev/null +++ b/modals/modal-room.php @@ -0,0 +1,261 @@ + + + + +
+

Fakel

+

Какое направление
вас интересует?

+ +
+ array( + 'title' => 'Fakel Fitness', + 'subtitle' => 'Фитнес-центр', + 'description' => 'Фитнес-центр мировых стандартов 2500 м². Оборудование из США, большая кардио-зона, более 45 направлений групповых программ, сауна, кафе, зона релакса и мн. др.', + 'button_text' => 'Фитнес-центр', + 'style' => 'light' + ), + 'gym' => array( + 'title' => 'Fakel Gym', + 'subtitle' => 'Тренажерный зал', + 'description' => 'Пространство для работы с весами, головными тренажерами и ничего лишнего. Идеальное соотношение цены и комфорта, если Вам необходим лишь тренажерный зал.', + 'button_text' => 'Тренажерный зал', + 'style' => 'dark' + ) + ); + + if ($languages) { + foreach ($languages as $lang_slug) { + // Получаем URL для языка + $lang_url = ''; + if (function_exists('pll_home_url')) { + if (is_singular() && function_exists('pll_get_post')) { + $translated_post_id = pll_get_post(get_the_ID(), $lang_slug); + if ($translated_post_id) { + $lang_url = get_permalink($translated_post_id); + } else { + $lang_url = pll_home_url($lang_slug); + } + } else { + $lang_url = pll_home_url($lang_slug); + } + } + + // Используем конфигурацию если есть, иначе дефолтные значения + if (isset($lang_config[$lang_slug])) { + $config = $lang_config[$lang_slug]; + } else { + // Получаем название языка + $lang_names = pll_languages_list(array('fields' => 'name')); + $lang_slugs = pll_languages_list(array('fields' => 'slug')); + $lang_index = array_search($lang_slug, $lang_slugs); + $lang_name = ($lang_index !== false && isset($lang_names[$lang_index])) + ? $lang_names[$lang_index] + : strtoupper($lang_slug); + + $config = array( + 'title' => $lang_name, + 'subtitle' => 'Версия сайта', + 'description' => 'Перейти на ' . $lang_name . ' версию сайта', + 'button_text' => 'Перейти', + 'style' => ($lang_slug === 'gym') ? 'dark' : 'light' + ); + } + + echo sprintf( + ' +
+

%s

+

%s

+
+
+

%s

+
+ +
', + esc_url($lang_url), + esc_attr($config['style']), + esc_attr($lang_slug), + esc_html($config['title']), + esc_html($config['subtitle']), + esc_html($config['description']), + esc_html($config['button_text']) + ); + } + } + ?> +
+
\ No newline at end of file diff --git a/modals/modal-time.php b/modals/modal-time.php new file mode 100644 index 0000000..a487ced --- /dev/null +++ b/modals/modal-time.php @@ -0,0 +1,13 @@ + +
+
+

Расписание

+ +
+ +
+
+
\ No newline at end of file diff --git a/navigation-menu.php b/navigation-menu.php new file mode 100644 index 0000000..9776a21 --- /dev/null +++ b/navigation-menu.php @@ -0,0 +1,180 @@ +term_id); + $current_lang = function_exists('pll_current_language') ? pll_current_language() : null; + + if ($menu_items) { + // Чистим заголовок от (переводов) + $clean_title = function($title) { + return trim(preg_replace('/\s*\([^)]*\)/', '', $title)); + }; + + $current_region = 'RU'; + + // Навигационная схема для Яндекса + $navigation_schema = array( + "@context" => "https://schema.org", + "@type" => "SiteNavigationElement", + "name" => "Главная навигация сайта", + "description" => "Основное меню навигации по сайту", + "inLanguage" => $current_lang ?: 'ru', + "areaServed" => $current_region, + "url" => array() + ); + + // Хлебные крошки для Яндекса + $breadcrumb_schema = array( + "@context" => "https://schema.org", + "@type" => "BreadcrumbList", + "itemListElement" => array() + ); + ?> + + + + + + + + + \ No newline at end of file