how i can limit woo Category number like as ‘posts_per_page’ => -1, but it cannot work please help me

Question
<section class="page-section">
  <div class="container">
    <div class="sec_con_pro">
      <div class="row">
        <?php
            $taxonomyName = "product_cat";
            $prod_categories = get_terms($taxonomyName, array(
                'orderby'=> 'name',
                'order' => 'ASC',
                'hide_empty' => 1,
            ));

            foreach( $prod_categories as $prod_cat ) :
                if ( $prod_cat->parent != 0 )
                    continue;
                $cat_thumb_id = get_woocommerce_term_meta( $prod_cat->term_id, 'thumbnail_id', true );
                $cat_thumb_url = wp_get_attachment_thumb_url( $cat_thumb_id );
                $term_link = get_term_link( $prod_cat, 'product_cat' );
                ?>
                <div class="col-md-2 col-xs-3 cat_container">
                  <div class="thumbnail no-border no-padding thumbnail-banner size-1x3">
                    <div class="media">
                      <div id="media_image-5" class="widget widget_media_image"><a href="<?php echo $term_link; ?>"><img src="<?php echo $cat_thumb_url; ?>" alt="" /></a></div>
                    </div>
                  </div>
                  <h4 class="caption-title cat_home_title"><a class="button" href="<?php echo $term_link; ?>"> <?php echo $prod_cat->name; ?> </a></h4>
                </div>
                <?php endforeach;
            wp_reset_query();
          ?>
      </div>
    </div>
  </div>
</section>
0
Jubayer Alam 4 years 2020-02-08T08:38:27-05:00 0 Answers 48 views 0

Leave an answer

Browse
Browse