V
V
Vasily Khryagin2020-10-19 11:47:18
PHP
Vasily Khryagin, 2020-10-19 11:47:18

How to add class to array of woocomerce products?

<?php
          $args = array ( 
                        'post_type'  => 'product',
                        'posts_per_page'  => -1,
                        'meta_query' => array( 
                          array( 
                            'value' => $_GET['type'], 
                            'compare' => 'like'
                          ), 
                        ), 
                      );
                      global $woocommerce, $woocommerce_loop;
                      $products = new WP_Query( $args );
                      if ( $products->have_posts() ) { ?>

              <?php woocommerce_product_loop_start(); ?>

                <?php while ( $products->have_posts() ) : $products->the_post(); ?>

                  <?php woocommerce_get_template_part( 'content', 'product' ); ?>

                <?php endwhile; // end of the loop. ?>

              <?php woocommerce_product_loop_end(); ?>

                      <?php }
            else echo'<h2>К сожалению в наличии нету шин подходящего типоразмера</h2>';
        ?>

Here is the code I insert into the slider on the home page, but the array is displayed in the container, and how can I set the class for this container so that it becomes a slider?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question