Почему не правильно отображается карусель?

Надо чтобы товары отображались как тут отзывы, при вставке сгенерированного кода всё встаёт как надо.
Но при генерации кода что-то ломается
<section class="about__reviews">
    <div class="container">
        <div class="section__title">Отзывы наших покупателей</div>
        <div class="about__reviews-wrap">
            <div class="about__reviews-slider">
                <div class="about__reviews-slide">
                    <?
                          $args = array(
                            'tax_query' => array(
                              'relation' => 'AND',
                              array(
                               'taxonomy' => 'product_tag',
                               'field' => 'slug',
                               'terms' => 'speczialnye-predlozheniya'
                             ),
                            ),
                            'posts_per_page' => 14,
                            'post_type' => 'product',
                            'orderby' => 'menu_order',
                          );
                    
                          $loop = new WP_Query( $args );
                          while ( $loop->have_posts() ) : $loop->the_post();
                            global $product;
                          ?>
                    <div class="main__catalog-item">
                        <div class="main__catalog-item-img-wrap">
                            <img src="<? echo get_the_post_thumbnail_url($loop->post->ID, array(237, 200)) ?>" alt=""
                                class="main__catalog-item-img">
                            <div class="main__catalog-item-hover">
                                <div class="main__catalog-item-hover-btn-wrap">
                                    <a href="<?php echo get_permalink( $loop->post->ID ) ?>" class="btn btn-border">
                                        Подробнее
                                        <svg width="11" height="14" viewBox="0 0 11 14" fill="none"
                                            xmlns="http://www.w3.org/2000/svg">
                                            <path
                                                d="M7.5625 1.4H1.375V12.6H9.625V3.5H7.5625V1.4ZM1.375 0H8.25L11 2.8V12.6C11 12.9713 10.8551 13.3274 10.5973 13.5899C10.3394 13.8525 9.98967 14 9.625 14H1.375C1.01033 14 0.660591 13.8525 0.402728 13.5899C0.144866 13.3274 0 12.9713 0 12.6V1.4C0 1.0287 0.144866 0.672601 0.402728 0.41005C0.660591 0.1475 1.01033 0 1.375 0ZM2.75 6.3H8.25V7.7H2.75V6.3ZM2.75 9.1H8.25V10.5H2.75V9.1Z" />
                                        </svg>
                                    </a>
                                    <a href="#" class="btn btn-white" data-btn="buy">
                                        Купить
                                        <svg width="13" height="14" viewBox="0 0 13 14" fill="none"
                                            xmlns="http://www.w3.org/2000/svg">
                                            <path
                                                d="M12.4091 3.5H9.89773V3.22C9.89773 1.442 8.37614 0 6.5 0C4.62386 0 3.10227 1.442 3.10227 3.22V3.5H0.590909C0.264062 3.5 0 3.75025 0 4.06V13.44C0 13.7498 0.264062 14 0.590909 14H12.4091C12.7359 14 13 13.7498 13 13.44V4.06C13 3.75025 12.7359 3.5 12.4091 3.5ZM4.43182 3.22C4.43182 2.13675 5.35696 1.26 6.5 1.26C7.64304 1.26 8.56818 2.13675 8.56818 3.22V3.5H4.43182V3.22ZM11.6705 12.74H1.32955V4.76H3.10227V6.3C3.10227 6.377 3.16875 6.44 3.25 6.44H4.28409C4.36534 6.44 4.43182 6.377 4.43182 6.3V4.76H8.56818V6.3C8.56818 6.377 8.63466 6.44 8.71591 6.44H9.75C9.83125 6.44 9.89773 6.377 9.89773 6.3V4.76H11.6705V12.74Z" />
                                        </svg>
                                    </a>
                                </div>
                                <div class="product__add-to-cart">
                                    <div class="input__count-wrap">
                                        <div class="input__count-min">&minus;</div>
                                        <input type="number" class="input__count" value="1" placeholder="1" min="1"
                                            max="1000">
                                        <div class="input__count-add">+</div>
                                    </div>
                                    <a href="?add-to-cart=<?php echo esc_attr( $product->get_id() ); ?>"
                                        class="add-to-cart-btn add_to_cart_button ajax_add_to_cart" data-quantity="1"
                                        data-product_id="<?php echo esc_attr( $product->get_id() ); ?>" rel="nofollow">
                                        <svg width="13" height="14" viewBox="0 0 13 14" fill="none"
                                            xmlns="http://www.w3.org/2000/svg">
                                            <path
                                                d="M12.4091 3.5H9.89773V3.22C9.89773 1.442 8.37614 0 6.5 0C4.62386 0 3.10227 1.442 3.10227 3.22V3.5H0.590909C0.264062 3.5 0 3.75025 0 4.06V13.44C0 13.7498 0.264062 14 0.590909 14H12.4091C12.7359 14 13 13.7498 13 13.44V4.06C13 3.75025 12.7359 3.5 12.4091 3.5ZM4.43182 3.22C4.43182 2.13675 5.35696 1.26 6.5 1.26C7.64304 1.26 8.56818 2.13675 8.56818 3.22V3.5H4.43182V3.22ZM11.6705 12.74H1.32955V4.76H3.10227V6.3C3.10227 6.377 3.16875 6.44 3.25 6.44H4.28409C4.36534 6.44 4.43182 6.377 4.43182 6.3V4.76H8.56818V6.3C8.56818 6.377 8.63466 6.44 8.71591 6.44H9.75C9.83125 6.44 9.89773 6.377 9.89773 6.3V4.76H11.6705V12.74Z" />
                                        </svg>
                                    </a>
                                </div>
                            </div>
                        </div>
                        <div class="main__catalog-item-desc">
                            <div class="main__catalog-item-title"><?php the_title(); ?></div>
                            <div class="main__catalog-item-fabric">
                                <? echo $product->get_attribute('proizvoditel'); ?>
                            </div>
                            <div class="main__catalog-item-price">
                                <div class="main__catalog-item-price-num">
                                    <?php echo number_format($product->price, 0, '', ' ' ); ?> руб.</div>
                                <span>/шт.</span>
                            </div>
                        </div>
                    </div>
                    <?php endwhile; ?>
                    <?php wp_reset_query(); ?>
                </div>
            </div>
            <div class="about__reviews-slider-controls slider-controls">
                <div class="arr prev"> <svg width="13" height="34" viewBox="0 0 13 34" fill="none"
                        xmlns="http://www.w3.org/2000/svg">
                        <path d="M12 1L1.35 15.2C0.55 16.2667 0.55 17.7333 1.35 18.8L12 33" stroke-width="1.5"
                            stroke-linecap="round" /> </svg></div>
                <div class="arr next"> <svg width="13" height="34" viewBox="0 0 13 34" fill="none"
                        xmlns="http://www.w3.org/2000/svg">
                        <path d="M12 1L1.35 15.2C0.55 16.2667 0.55 17.7333 1.35 18.8L12 33" stroke-width="1.5"
                            stroke-linecap="round" /> </svg></div>
                <div class="pagination"></div>
            </div>
        </div>
    </div>
</section>
  • Вопрос задан
  • 69 просмотров
Решения вопроса 1
@Ylia_dr Автор вопроса
Нашёл ошибку. Цикл помещал не в тот div. Надо было на уровень выше
Ответ написан
Комментировать
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы