Jamil-Abdullayev b8246597d4 Initial commit: orgsteklo WordPress theme
Custom WooCommerce theme for orgsteklo.ru including:
- Product catalog with category/subcategory hierarchy
- Custom checkout with delivery calculation
- Price calculator
- Admin settings panel
- Search functionality
- User account pages
2026-03-05 00:48:06 +04:00

248 lines
14 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!--
Template Name: Шаблон Главная
-->
<?php get_header(); ?>
<main>
<?php
$home_sliders = get_field('home_slider');
$home_advantages = get_field('home_advantage');
if($home_sliders) {
?>
<section class="banner">
<div class="banner-container container">
<div class="banner-main">
<?php
if($home_sliders) {
echo '<div class="banner-slider"><div class="banner-swiper swiper"><div class="swiper-wrapper">';
foreach ($home_sliders as $home_slider) {
$home_slider_fon = $home_slider['home_slider_fon'];
$home_slider_date = $home_slider['home_slider_date'];
$home_slider_title = $home_slider['home_slider_title'];
$home_slider_text = $home_slider['home_slider_text'];
$home_slider_link = $home_slider['home_slider_link'];
echo '<div class="swiper-slide">';
echo '<div class="banner-slide">';
if($home_slider_fon) {
echo '<img class="banner-slide__img" src="' . esc_url($home_slider_fon['url']) . '" alt="' . esc_attr($home_slider_fon['alt']) . '">';
}
if($home_slider_date) {
echo '<h4>' . $home_slider_date . '</h4>';
}
if($home_slider_title) {
echo '<h2>' . $home_slider_title . '</h2>';
}
if($home_slider_link) {
echo '<a href="' . $home_slider_link . '" class="banner-slide__link">' . $home_slider_text . '<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M10.8232 4.44727L15.3757 8.99977L10.8232 13.5523" stroke="white" stroke-width="1.5" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/><path d="M2.625 9H15.2475" stroke="white" stroke-width="1.5" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/></svg></a>';
}
echo '</div>';
echo '</div>';
}
echo '</div></div><button class="banner-prev"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M10.0596 13.2802L5.7129 8.93355C5.19957 8.42021 5.19957 7.58021 5.7129 7.06688L10.0596 2.72021" stroke="white" stroke-width="1.5" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/></svg></button><button class="banner-next"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M5.94043 13.2802L10.2871 8.93355C10.8004 8.42021 10.8004 7.58021 10.2871 7.06688L5.94043 2.72021" stroke="white" stroke-width="1.5" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/></svg></button></div>';
}
?>
<?php
if($home_advantages) {
echo '<div class="banner-grid">';
foreach ($home_advantages as $home_advantage) {
$home_advantage_icon = $home_advantage['home_advantage_icon'];
$home_advantage_title = $home_advantage['home_advantage_title'];
echo '<div class="banner-item">';
if($home_advantage_icon) {
echo '<img src="' . esc_url($home_advantage_icon['url']) . '" alt="' . esc_attr($home_advantage_icon['alt']) . '">';
}
if($home_advantage_title) {
echo '<p>' . $home_advantage_title . '</p>';
}
echo '</div>';
}
echo '</div>';
}
?>
</div>
</div>
</section>
<?php
}
?>
<?php
$home_production_title = get_field('home_production_title');
if($home_production_title) {
?>
<section class="categories">
<div class="categories-container container">
<?php
if($home_production_title) {
echo '<h2>' . $home_production_title . '</h2>';
}
?>
<div class="categories-main">
<div class="categories-grid">
<?php
$categories = get_terms([
'taxonomy' => 'product_cat',
'parent' => 0,
'hide_empty' => false,
]);
if (!empty($categories) && !is_wp_error($categories)) {
$count = 0;
foreach ($categories as $category) {
if ($category->name === 'Misc') {
continue;
}
$count++;
$is_hidden = $count > 6 ? ' hidden' : '';
$thumb_id = get_term_meta($category->term_id, 'thumbnail_id', true);
$thumb_url = $thumb_id ? wp_get_attachment_image_url($thumb_id, 'full') : '/wp-content/uploads/woocommerce-placeholder.png';
$term_link = get_term_link($category);
?>
<div class="categories-item<?php echo esc_attr($is_hidden); ?>">
<a href="<?php echo esc_url($term_link); ?>" class="categories-item__img">
<img src="<?php echo esc_url($thumb_url); ?>" alt="<?php echo esc_attr($category->name); ?>">
</a>
<div class="categories-item__main">
<a href="<?php echo esc_url($term_link); ?>" class="categories-item__title">
<?php echo esc_html($category->name); ?>
<svg width="24" height="25" viewBox="0 0 24 25" fill="none" xmlns="http://www.w3.org/2000/svg"><g clip-path="url(#clip0_305_8960)"><path d="M23.12 10.41L19.25 6.50002C19.157 6.40629 19.0464 6.3319 18.9246 6.28113C18.8027 6.23036 18.672 6.20422 18.54 6.20422C18.408 6.20422 18.2773 6.23036 18.1554 6.28113C18.0336 6.3319 17.923 6.40629 17.83 6.50002C17.6437 6.68738 17.5392 6.94084 17.5392 7.20502C17.5392 7.46921 17.6437 7.72266 17.83 7.91002L21.39 11.5H1C0.734784 11.5 0.48043 11.6054 0.292893 11.7929C0.105357 11.9805 0 12.2348 0 12.5H0C0 12.7652 0.105357 13.0196 0.292893 13.2071C0.48043 13.3947 0.734784 13.5 1 13.5H21.45L17.83 17.11C17.7363 17.203 17.6619 17.3136 17.6111 17.4354C17.5603 17.5573 17.5342 17.688 17.5342 17.82C17.5342 17.952 17.5603 18.0827 17.6111 18.2046C17.6619 18.3265 17.7363 18.4371 17.83 18.53C17.923 18.6238 18.0336 18.6981 18.1554 18.7489C18.2773 18.7997 18.408 18.8258 18.54 18.8258C18.672 18.8258 18.8027 18.7997 18.9246 18.7489C19.0464 18.6981 19.157 18.6238 19.25 18.53L23.12 14.65C23.6818 14.0875 23.9974 13.325 23.9974 12.53C23.9974 11.735 23.6818 10.9725 23.12 10.41Z" fill="#02ADEF"/></g><defs><clipPath id="clip0_305_8960"><rect width="24" height="24" fill="white" transform="translate(0 0.5)"/></clipPath></defs></svg>
</a>
</div>
</div>
<?php
}
}
?>
</div>
<?php if (count($categories) > 6): ?>
<button class="categories-more" id="home_categories_more">
Показать еще
<svg width="16" height="17" viewBox="0 0 16 17" fill="none" xmlns="http://www.w3.org/2000/svg"><g clip-path="url(#clip0_3004_541)"><path d="M7.99981 1.83327C8.88415 1.83617 9.75913 2.01443 10.5741 2.35773C11.3891 2.70103 12.1279 3.20255 12.7478 3.83327H10.6665C10.4897 3.83327 10.3201 3.90351 10.1951 4.02854C10.07 4.15356 9.99981 4.32313 9.99981 4.49994C9.99981 4.67675 10.07 4.84632 10.1951 4.97134C10.3201 5.09637 10.4897 5.16661 10.6665 5.16661H13.4285C13.7568 5.16643 14.0715 5.03594 14.3037 4.80381C14.5358 4.57168 14.6663 4.25689 14.6665 3.92861V1.16661C14.6665 0.989796 14.5962 0.820226 14.4712 0.695202C14.3462 0.570178 14.1766 0.49994 13.9998 0.49994V0.49994C13.823 0.49994 13.6534 0.570178 13.5284 0.695202C13.4034 0.820226 13.3331 0.989796 13.3331 1.16661V2.55194C12.2313 1.55958 10.8749 0.893546 9.41587 0.628439C7.95688 0.363332 6.45289 0.509614 5.07233 1.0509C3.69177 1.5922 2.48915 2.50712 1.59915 3.69322C0.709148 4.87932 0.166904 6.28977 0.0331428 7.76661C0.0245317 7.85945 0.0353533 7.95306 0.0649181 8.04149C0.0944829 8.12991 0.142143 8.21121 0.20486 8.2802C0.267578 8.34919 0.343979 8.40436 0.429195 8.44219C0.514411 8.48002 0.606573 8.49969 0.699809 8.49994V8.49994C0.862868 8.50202 1.02083 8.44317 1.14278 8.3349C1.26473 8.22664 1.34189 8.07676 1.35914 7.91461C1.50755 6.25511 2.27113 4.71108 3.49986 3.58583C4.7286 2.46059 6.33369 1.83547 7.99981 1.83327Z" fill="white"/><path d="M15.3003 8.50005C15.1373 8.49798 14.9793 8.55683 14.8574 8.66509C14.7354 8.77335 14.6583 8.92323 14.641 9.08539C14.5308 10.3542 14.059 11.5648 13.2814 12.5735C12.5039 13.5823 11.4534 14.3468 10.2544 14.7764C9.0555 15.2061 7.75847 15.2828 6.51724 14.9975C5.27601 14.7122 4.14267 14.0768 3.25167 13.1667H5.33301C5.50982 13.1667 5.67939 13.0965 5.80441 12.9715C5.92944 12.8464 5.99967 12.6769 5.99967 12.5001C5.99967 12.3233 5.92944 12.1537 5.80441 12.0287C5.67939 11.9036 5.50982 11.8334 5.33301 11.8334H2.57101C2.40841 11.8333 2.24738 11.8653 2.09714 11.9275C1.9469 11.9896 1.81039 12.0808 1.69541 12.1958C1.58044 12.3108 1.48925 12.4473 1.42707 12.5975C1.36488 12.7478 1.33292 12.9088 1.33301 13.0714V15.8334C1.33301 16.0102 1.40325 16.1798 1.52827 16.3048C1.65329 16.4298 1.82286 16.5001 1.99967 16.5001C2.17649 16.5001 2.34605 16.4298 2.47108 16.3048C2.5961 16.1798 2.66634 16.0102 2.66634 15.8334V14.4481C3.76823 15.4404 5.12462 16.1065 6.58361 16.3716C8.0426 16.6367 9.54659 16.4904 10.9272 15.9491C12.3077 15.4078 13.5103 14.4929 14.4003 13.3068C15.2903 12.1207 15.8326 10.7102 15.9663 9.23339C15.975 9.14055 15.9641 9.04694 15.9346 8.95851C15.905 8.87008 15.8573 8.78879 15.7946 8.7198C15.7319 8.65081 15.6555 8.59564 15.5703 8.5578C15.4851 8.51997 15.3929 8.5003 15.2997 8.50005H15.3003Z" fill="white"/></g><defs><clipPath id="clip0_3004_541"><rect width="16" height="16" fill="white" transform="translate(0 0.5)"/></clipPath></defs></svg>
</button>
<?php endif; ?>
</div>
</div>
</section>
<?php
}
?>
<?php
$home_popular_title = get_field('home_popular_title');
if($home_popular_title) {
?>
<section class="products">
<div class="products-container container">
<?php
if($home_popular_title) {
echo '<h2>' . $home_popular_title . '</h2>';
}
?>
<div class="products-slider">
<div class="products-swiper swiper">
<div class="swiper-wrapper">
<?php
$args = array(
'post_type' => 'product',
'posts_per_page' => 4,
'orderby' => 'rand',
'post_status' => array( 'publish', 'draft' ),
'ignore_sticky_posts' => 1,
'tax_query' => array(
array(
'taxonomy' => 'product_tag',
'field' => 'slug',
'terms' => 'popular',
),
),
);
$random_products = new WP_Query( $args );
if ( $random_products->have_posts() ) :
while ( $random_products->have_posts() ) : $random_products->the_post();
echo '<div class="swiper-slide">';
wc_get_template_part( 'content', 'product' );
echo '</div>';
endwhile;
wp_reset_postdata();
endif;
?>
</div>
</div>
<button class="products-prev"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M10.0596 13.28L5.7129 8.9333C5.19957 8.41997 5.19957 7.57997 5.7129 7.06664L10.0596 2.71997" stroke="white" stroke-width="1.5" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/></svg></button>
<button class="products-next"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M5.94043 13.28L10.2871 8.9333C10.8004 8.41997 10.8004 7.57997 10.2871 7.06664L5.94043 2.71997" stroke="white" stroke-width="1.5" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/></svg></button>
</div>
<div class="products-mob">
<?php
$args = array(
'post_type' => 'product',
'posts_per_page' => 4,
'orderby' => 'rand',
'post_status' => array( 'publish', 'draft' ),
'ignore_sticky_posts' => 1,
'tax_query' => array(
array(
'taxonomy' => 'product_tag',
'field' => 'slug',
'terms' => 'popular',
),
),
);
$random_products = new WP_Query( $args );
if ( $random_products->have_posts() ) :
while ( $random_products->have_posts() ) : $random_products->the_post();
wc_get_template_part( 'content', 'product' );
endwhile;
wp_reset_postdata();
endif;
?>
</div>
</div>
</section>
<?php
}
?>
<?php
$home_about_title = get_field('home_about_title');
$home_about_subtitle = get_field('home_about_subtitle');
$home_about_description = get_field('home_about_description');
$home_about_link = get_field('home_about_link');
$home_about_img = get_field('home_about_img');
if($home_about_title) {
?>
<section class="about">
<div class="about-container container">
<?php
if($home_about_img) {
echo '<img src="' . esc_url($home_about_img['url']) . '" alt="' . esc_attr($home_about_img['alt']) . '">';
}
?>
<div class="about-main">
<?php
if($home_about_title) {
echo '<h2>' . $home_about_title . '</h2>';
}
if($home_about_subtitle) {
echo '<p class="about-subtitle">' . $home_about_subtitle . '</p>';
}
if($home_about_description) {
echo '<p class="about-description">' . $home_about_description . '</p>';
}
if($home_about_link) {
echo '<a href="' . $home_about_link . '" class="link-more">Подробнее о нас<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M14.9997 10C14.9956 9.56159 14.819 9.14243 14.508 8.83335L10.933 5.25002C10.7769 5.09481 10.5657 5.00769 10.3455 5.00769C10.1254 5.00769 9.91414 5.09481 9.75801 5.25002C9.6799 5.32749 9.61791 5.41965 9.5756 5.5212C9.53329 5.62275 9.51151 5.73167 9.51151 5.84168C9.51151 5.95169 9.53329 6.06061 9.5756 6.16216C9.61791 6.26371 9.6799 6.35588 9.75801 6.43335L12.4997 9.16668H4.16634C3.94533 9.16668 3.73337 9.25448 3.57709 9.41076C3.42081 9.56704 3.33301 9.779 3.33301 10C3.33301 10.221 3.42081 10.433 3.57709 10.5893C3.73337 10.7455 3.94533 10.8333 4.16634 10.8333H12.4997L9.75801 13.575C9.60109 13.7308 9.51249 13.9426 9.51171 14.1637C9.51093 14.3849 9.59803 14.5973 9.75384 14.7542C9.90966 14.9111 10.1214 14.9997 10.3426 15.0005C10.5637 15.0013 10.7761 14.9142 10.933 14.7583L14.508 11.175C14.821 10.8639 14.9978 10.4413 14.9997 10Z" fill="#02ADEF"/></svg></a>';
}
?>
</div>
</div>
</section>
<?php
}
?>
<?php get_template_part( 'blocks/block', 'why' ); ?>
<?php get_template_part( 'blocks/block', 'info' ); ?>
<?php get_template_part( 'blocks/block', 'consult' ); ?>
</main>
<style>
.pc_menu__fon.active {
display: none !important;
}
body.hidden {
overflow: auto;
}
</style>
<?php get_footer(); ?>