HEX
Server: Apache/2.4.62 (Debian)
System: Linux plxsite 6.8.0-47-generic #47-Ubuntu SMP PREEMPT_DYNAMIC Fri Sep 27 21:40:26 UTC 2024 x86_64
User: root (0)
PHP: 8.1.30
Disabled: NONE
Upload Files
File: /var/www/html/wp-content/themes/polygant_2025/archive.php
<?php
/**
 * The template for displaying archive pages
 *
 * @link https://developer.wordpress.org/themes/basics/template-hierarchy/
 *
 * @package polugant_by_chernikova
 */


?>
<?php get_header('new');

$queried_object = get_queried_object(); 
$category = get_queried_object();   // через объект
$catid =  $category->term_id;?>


<section class="info-page pageservcases">
   
        <div class="container">

            <div class="bread">
                   <p id="breadcrumbs"><span><span> <?php   $my_home_url = "/"; ?>
                    <a href="<?php echo $my_home_url; ?>" ><?php the_field('главная_название' ,  233 );?></a></span> — <span><a href="/services/">Services</a></span> — <span class="breadcrumb_last" aria-current="page">   <?php the_field('основное_название_категории' , $queried_object); ?></span></span></p>
            </div>
            
            <div class="archive-serv-header">
                <div class="archive-serv-header-icon">  <img src="  <?php the_field('иконка_категории' , $queried_object); ?>" alt="">   </div>
                <h1 class="page-cases-title info-page__title"><?php the_field('основное_название_категории' , $queried_object); ?></h1>
            </div>

            <div class="one-single-post-header-sf">
                <div class="one-single-post-header-sf-left">
                    <?php if( get_field("краткое_описание", $queried_object) ): ?>
                        <div class="dop-descr-single-service info-page__content content">
                            <?php the_field('краткое_описание', $queried_object);?>
                        </div>
                    <?php else :?>
                    <?php endif; ?>
              
                                    
                    <?php
                    if( have_rows('преимущества_или_услуги', $queried_object ) ):
                    ?>
                        <div class="dop-priem-single-service">
                            <?php
                            while ( have_rows('преимущества_или_услуги', $queried_object ) ) : the_row();
                            ?>
                            <div class="dop-priem-single-service-item"><img src="/wp-content/uploads/2023/06/check.svg"> <?php the_sub_field('пункт_преимущества'); ?></div>
                            <?php
                            endwhile;
                            ?>
                        </div>
                    <?php
                    else :
                    endif;
                    ?> 
                    
                    <?php if( get_field("краткое_описание", $queried_object) ): ?>               
                    <div class="archive-line-qw0whats rubread11 test">
                        <a href="" data-popup="form" class="hero__btn">   <?php the_field('request_a_quote' , 233 );?>    </a>
                        <span>  <?php the_field('or_contact_us_on' ,  233 );?>
                        <a href="https://wa.me/message/SUBN2P3AVQCOF1" >  <img src="/wp-content/uploads/2023/06/wh.svg" alt="whatsapp">  WhatsApp   </a></span> 
                    </div>
                         
                    <div class="hero__footer enbread11">
                                <?php if (get_field("sp_btn_first_title", $queried_object)) { ?>
                                <?php $btn_title1 = get_field("sp_btn_first_title", $queried_object); ?>
                                <?php } else { ?>
                                <?php $btn_title1 = ""; ?>
                                <?php } ?>
                                <a href="#" data-popup="form" class="hero__btn"><?php echo $btn_title1; ?></a>
                                <?php if (get_field("sp_btn_first_title_extra", $queried_object)) { ?>
                                <a href="<?php the_field('sp_btn_first_title_extra_link', $queried_object);?>" target="_blank" class="hero__btn extra"><?php the_field('sp_btn_first_title_extra', $queried_object);?></a>
                                <?php } ?>            
                    </div>
                    <?php else :?> 
                    <?php endif; ?> 
                </div>

                <?php if( get_field("краткое_описание", $queried_object) ): ?>
                <?php 

                ?> 
                <div class="one-single-post-header-sf-right">
                    <div class="one-single-post-header-sf-right-image" style="background: url(<?php the_field('archive_main_img_5', $queried_object); ?>); background-position: center; background-repeat: no-repeat; background-size: cover;"></div>
                </div>
                <?php

                ?>
                <?php
                else :
                endif;
                ?>         
            </div>


            <div class="service-wrapper-in-archive-paglist new-list">
            <h2 class="sp-h2-title"><?php the_field('archive_list_title', $queried_object); ?></h2>    
            <div class="list-wrap">       
            <?php 
            $posts = get_posts( array(
              'numberposts' => 244,     
              'cat' => $catid,
              'post_type'   => 'post',
              'suppress_filters' => true, // подавление работы фильтров изменения SQL запроса
            ) );
            global $post;   
            
            foreach ( $posts as $post ) {
              setup_postdata($post);
                ?>    
                <a class="item" href="<?php the_permalink(); ?> " ><?php the_title();?></a>  
            <?php
            }
            wp_reset_postdata(); // сброс
            ?>                   
            </div>
            </div>
            
            
            <?php
            $vk_video_extra = get_field( "vk_content_shortcode", $queried_object );
            if ( $vk_video_extra ) {
                ?>
                <div class="vk-video-extra-sec">
                    <?php echo do_shortcode( get_field( "vk_content_shortcode", $queried_object ) ); ?>
                </div>
                <?php
            }
            ?>
            
            
            
            
<?php
            $chat_bot_show = get_field( "chat_bot_show", $queried_object );
            if ( $chat_bot_show ) {
                ?>          
            <h2 class="sp-h2-title polygant-chat"><?php the_field('chat_bot_show_title', $queried_object); ?></h2>
    <div class="chat-container" id="polygant-chat">
  <div class="chat-header">Polygant ChatBot</div>
  <div class="chat-messages" id="messages"></div>
  <form class="chat-input" id="chatForm">
    <input type="text" id="userInput" placeholder="Write a message..." autocomplete="off" />
    <button type="submit">Send</button>
  </form>
</div>

<script>
    function getOrCreateVisitorId() {
      let visitorId = localStorage.getItem("visitor_id");
      if (!visitorId) {
        visitorId = crypto.randomUUID();  // или Math.random().toString(36).substring(2)
        localStorage.setItem("visitor_id", visitorId);
      }
      return visitorId;
    }
  //const API_BASE = "https://mgnmrestapi-production.up.railway.app";
    const API_BASE = "<?php the_field('api_url', $queried_object); ?>";
  const messagesContainer = document.getElementById("messages");
  const chatForm = document.getElementById("chatForm");
  const userInput = document.getElementById("userInput");
  const visitorId = getOrCreateVisitorId();

  const visitor = {
    name: "Test",
    email: "[email protected]",
	language: "en",
    id: visitorId
  };

  // Добавление сообщения
  function addMessage(text, sender = "bot", isTyping = false) {
    const message = document.createElement("div");
    message.className = `message ${sender}`;

    const avatar = document.createElement("div");
    avatar.className = `avatar ${sender}`;

    const bubble = document.createElement("div");
    bubble.className = "text";

    if (isTyping) {
      bubble.innerHTML = '<span class="typing">Bot is typing a reply...</span>';
    } else {
      bubble.textContent = text;
    }

    message.appendChild(avatar);
    message.appendChild(bubble);
    messagesContainer.appendChild(message);
    messagesContainer.scrollTop = messagesContainer.scrollHeight;

    return message;
  }

  // Отправка сообщений
  chatForm.addEventListener("submit", async (e) => {
    e.preventDefault();
    const question = userInput.value.trim();
    if (!question) return;

    addMessage(question, "user");
    userInput.value = "";

    const typingMsg = addMessage("", "bot", true);

    try {
      const response = await fetch(`${API_BASE}`, {
        method: "POST",
        headers: { "Content-Type": "application/json" },
        body: JSON.stringify({
          handler: "message",
          visitor,
          message: { text: question }
        })
      });

      const data = await response.json();
      messagesContainer.removeChild(typingMsg);

      (data.replies || []).forEach(reply => addMessage(reply, "bot"));
    } catch (err) {
      messagesContainer.removeChild(typingMsg);
      addMessage("An error occurred while receiving a response.", "bot");
    }
  });

  // Приветствие через handler: "trigger"
  window.addEventListener("DOMContentLoaded", async () => {
    const typingMsg = addMessage("", "bot", true);

    try {
      const response = await fetch(`${API_BASE}`, {
        method: "POST",
        headers: { "Content-Type": "application/json" },
        body: JSON.stringify({
          handler: "trigger",
          visitor
        })
      });

      const data = await response.json();
      messagesContainer.removeChild(typingMsg);

      (data.replies || []).forEach(reply => addMessage(reply, "bot"));
    } catch (err) {
      messagesContainer.removeChild(typingMsg);
      addMessage("Бот временно недоступен.", "bot");
    }
  });
</script>
<?php
            }
            ?>
            
            
            
            
            
            
            
            
            <div class="dop-cat-text info-page__content content">
                <?php the_field('текст_в_категории'  , $queried_object);?>
            </div>





         <?php
        $sec3 = get_field('sp_sec_3', $queried_object);
        if( $sec3 ): ?>
        <div class="sp_sec_3" id="sp_sec_3">
            <h2 class="sp-h2-title"><?php echo $sec3['заголовок']; ?></h2>
            <div class="content-wrap">
                <div class="first">
                    <?php
                    while ( have_rows( 'sp_sec_3', $queried_object ) ) : the_row();
                      while ( have_rows( 'list', $queried_object ) ) : the_row();
                          ?>
                          <div class="item">
                            <p class="title"><?php the_sub_field( 'title' ); ?></p>
                            <p class="subtitle"><?php the_sub_field( 'descr' ); ?></p>
                          </div>
                          <?php
                      endwhile;
                    endwhile;
                    ?>
                </div>
                <div class="second" style="background-image: url('<?php echo $sec3['img']; ?>');">
                </div>
            </div>
        </div>
        <?php endif; ?>


    </div>
</section>





<?php            
$args = array(
    'post_type' => 'cases',
    'post_count' => -1,
    'cat' => $catid ,
);
$the_query = new WP_Query( $args );
if ( $the_query->have_posts() ) : ?>
<section class="info-page one">
<div class="container">
<div class="info-page__case reviews">
                                    <div class="reviews__head">
                                        <h2 class="info-page__case-title sp-h2-title"><?php the_field('archive_projects_title', $queried_object);?></h2>
                                        <div class="slider-controls reviews__controls">
                                            <div class="slider-controls__arrow slider-controls__arrow_prev info-page__arrow_prev">
                                                <svg width="8" height="13" viewBox="0 0 8 13" fill="none" xmlns="http://www.w3.org/2000/svg">
                                                    <path fill-rule="evenodd" clip-rule="evenodd" d="M0.701814 10.821C0.357147 11.1657 0.357146 11.7245 0.701814 12.0692C1.04648 12.4138 1.6053 12.4138 1.94997 12.0692L7.0567 6.96242C7.06091 6.95836 7.0651 6.95426 7.06925 6.95011C7.30422 6.71514 7.379 6.38066 7.29361 6.08234C7.25375 5.94299 7.17895 5.81152 7.0692 5.70177C7.06612 5.69869 7.06303 5.69564 7.05991 5.69262L1.99144 0.624142C1.64677 0.279475 1.08796 0.279475 0.743289 0.624143C0.398621 0.96881 0.398622 1.52763 0.743289 1.8723L5.1969 6.32591L0.701814 10.821Z" fill="#6352CD"/>
                                                </svg>                                
                                            </div>
                                            <div class="slider-controls__pagination info-page__pagination cases-scr"></div>
                                            <div class="slider-controls__arrow slider-controls__arrow_next info-page__arrow_next">
                                                <svg width="8" height="13" viewBox="0 0 8 13" fill="none" xmlns="http://www.w3.org/2000/svg">
                                                    <path fill-rule="evenodd" clip-rule="evenodd" d="M0.701814 10.821C0.357147 11.1657 0.357146 11.7245 0.701814 12.0692C1.04648 12.4138 1.6053 12.4138 1.94997 12.0692L7.0567 6.96242C7.06091 6.95836 7.0651 6.95426 7.06925 6.95011C7.30422 6.71514 7.379 6.38066 7.29361 6.08234C7.25375 5.94299 7.17895 5.81152 7.0692 5.70177C7.06612 5.69869 7.06303 5.69564 7.05991 5.69262L1.99144 0.624142C1.64677 0.279475 1.08796 0.279475 0.743289 0.624143C0.398621 0.96881 0.398622 1.52763 0.743289 1.8723L5.1969 6.32591L0.701814 10.821Z" fill="#6352CD"/>
                                                </svg>                                
                                            </div>
                                        </div>
                                    </div>

                                    
                                    <div class="swiper info-page__slider cases-scr">
                                    <div class="swiper-wrapper">
                                        <?php while ( $the_query->have_posts() ) : ?>
                                        <?php $the_query->the_post(); ?>
                                    <div class="cases-item swiper-slide reviews-item">
                                        <div class="cases-item__img">
                                            <?php the_post_thumbnail('full'); ?>
                                        </div>
                                        <div class="cases-item__main">
                                            <h3 class="cases-item__title">
                                                <?php the_title(); ?>
                                            </h3>
                                            <div class="cases-item__label">
                                                <?php the_field('case-label'); ?>
                                            </div>
                                            <div class="cases-item__text">
                                                <p>
                                                        <?php the_field('case-descr');?> 
                                                </p>
                                              
                                            </div>
                                            <a href="<?php the_permalink(); ?>" class="cases-item__btn"> <?php the_field('read_more' ,  233 );?></a>
                                        </div>
                                    </div>
                                    <?php endwhile; ?>

                                </div>
                                </div>
</div>
</div>
</section>
<?php endif; ?>
<?php wp_reset_postdata(); ?>





<?php              
$args = array(
    'post_type' => 'reviews',
    'post_count' => -1,
    'cat' => $catid ,
);

$the_query = new WP_Query( $args );
if ( $the_query->have_posts() ) : ?>

<section class="reviews">
    <div class="container">

   <div class="info-page__reviews swiper-check">
                                <div class="reviews__head">
                                    <h2 class="reviews__title sp-h2-title"> 
                                           <?php the_field('archive_reviews_title', $queried_object);?>
                                    </h2>
                                    <div class="slider-controls reviews__controls">
                                        <div class="slider-controls__arrow slider-controls__arrow_prev info-page__arrow_prev">
                                            <svg width="8" height="13" viewBox="0 0 8 13" fill="none" xmlns="http://www.w3.org/2000/svg">
                                                <path fill-rule="evenodd" clip-rule="evenodd" d="M0.701814 10.821C0.357147 11.1657 0.357146 11.7245 0.701814 12.0692C1.04648 12.4138 1.6053 12.4138 1.94997 12.0692L7.0567 6.96242C7.06091 6.95836 7.0651 6.95426 7.06925 6.95011C7.30422 6.71514 7.379 6.38066 7.29361 6.08234C7.25375 5.94299 7.17895 5.81152 7.0692 5.70177C7.06612 5.69869 7.06303 5.69564 7.05991 5.69262L1.99144 0.624142C1.64677 0.279475 1.08796 0.279475 0.743289 0.624143C0.398621 0.96881 0.398622 1.52763 0.743289 1.8723L5.1969 6.32591L0.701814 10.821Z" fill="#6352CD"/>
                                            </svg>                                
                                        </div>
                                        <div class="slider-controls__pagination info-page__pagination"></div>
                                        <div class="slider-controls__arrow slider-controls__arrow_next info-page__arrow_next">
                                            <svg width="8" height="13" viewBox="0 0 8 13" fill="none" xmlns="http://www.w3.org/2000/svg">
                                                <path fill-rule="evenodd" clip-rule="evenodd" d="M0.701814 10.821C0.357147 11.1657 0.357146 11.7245 0.701814 12.0692C1.04648 12.4138 1.6053 12.4138 1.94997 12.0692L7.0567 6.96242C7.06091 6.95836 7.0651 6.95426 7.06925 6.95011C7.30422 6.71514 7.379 6.38066 7.29361 6.08234C7.25375 5.94299 7.17895 5.81152 7.0692 5.70177C7.06612 5.69869 7.06303 5.69564 7.05991 5.69262L1.99144 0.624142C1.64677 0.279475 1.08796 0.279475 0.743289 0.624143C0.398621 0.96881 0.398622 1.52763 0.743289 1.8723L5.1969 6.32591L0.701814 10.821Z" fill="#6352CD"/>
                                            </svg>                                
                                        </div>
                                    </div>
                                </div>
                                <div class="swiper info-page__slider">
                                    <div class="swiper-wrapper">
                                                     
                                        <?php while ( $the_query->have_posts() ) : ?>
                                            <?php $the_query->the_post(); ?>
                                        <div class="swiper-slide reviews-item">
                                                <div class="reviews-item__text">
                                                <p><?php the_content(); ?></p>
                                                </div>
                                                <div class="reviews-author reviews-item__author">
                                                    <div class="reviews-author__img">
                                                    <?php the_post_thumbnail('full'); ?>
                                                    </div>
                                                    <div class="reviews-author__info">
                                                        <div class="reviews-author__name">
                                                          <?php the_title();?>
                                                        </div>
                                                        <div class="reviews-author__desc">
                                                                 <?php echo get_field('author-suptitle'); ?>
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="reviews-item__icon">
                                               <img src="<?php echo get_template_directory_uri(); ?>/inc/img/new-img//quote.svg" alt="qoute">
                                                </div>
                                            </div>
                    <?php endwhile; ?>  
      </div>
                                </div>
                            </div>
    </div>
</section> 
<?php endif; ?>
<?php wp_reset_postdata(); ?>



<section class="info-page two">
<div class="container">

<?php get_template_part('template-parts/contact-us-section'); ?>


<?php if( get_field("faq_-__верхний_заголовок", $queried_object) ): ?>
                <?php $faqSchema = ''; ?>
                <div class="section-faq-home-page article">
                    <div class="container">
                        <div class="container-faq-home">
                            <div class="faq-home-left">
                                <div class="more-article-about-theme sp-h2-title"><?php the_field('faq_-__верхний_заголовок', $queried_object);?></div>
                            </div>
                            <div class="faq-home-right">
                                <?php if (get_field("img_for_faq", $queried_object)) { ?>
                                <?php $faq_img1 = get_field("img_for_faq", $queried_object); ?>
                                <?php } else { ?>
                                <?php $faq_img1 = "/wp-content/uploads/2025/07/faq-opt.png"; ?>
                                <?php } ?>
                                <div class="img" style="background-image: url('<?php echo $faq_img1; ?>');"></div>
                                <div class="daccordion2" id="daccordion2">
                                                    
                                <?php if(get_field('faq_вопрос_ответ', $queried_object)): ?>
                                <?php while(has_sub_field('faq_вопрос_ответ', $queried_object)): ?>

                                <?php $faqSchema .= '{
                                    "@type": "Question",
                                    "name": "'.get_sub_field('faq_-_вопрос').'",
                                    "acceptedAnswer": {
                                    "@type": "Answer",
                                    "text": "'.get_sub_field('faq_-_ответ').'"
                                } },'; ?>
                        
                                <div class="daccordion__item2">
                                    <div class="daccordion__title2"><?php the_sub_field('faq_-_вопрос'); ?><div class="arrac"><svg width="15" height="15" viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg"><rect x="5.65625" y="12.728" width="10" height="2" rx="1" transform="rotate(-45 5.65625 12.728)" fill="#29292D"/><rect x="7.07031" y="0.000244141" width="10" height="2" rx="1" transform="rotate(45 7.07031 0.000244141)" fill="#29292D"/></svg> </div></div>
                                    <div class="daccordion__content2"><?php the_sub_field('faq_-_ответ'); ?>
                                    </div>
                                </div>
                            
                            
                                <?php endwhile; ?>
                                <?php endif; ?>
                                               
                                <script type="application/ld+json">
                                {
                                "@context": "https://schema.org",
                                "@type": "FAQPage",
                                "mainEntity":[ 
                                <?php echo rtrim($faqSchema,','); ?>
                                ]
                                }
                                </script>                                       
                                
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <?php else :?>    
                <?php endif; ?>


</div>
</section>





<?php
get_footer('new');