Answer the question
In order to leave comments, you need to log in
Incrementing woocommerce files?
Hi all!
I need to start incrementing in the content-product.php file, that is, before the cycle <?php $i = 1; ?>
In the cycle
<?php echo $i; ?>
<?php $i ++; ?>
Answer the question
In order to leave comments, you need to log in
Hello.
Loop in archive-product.php file.
Surely there is some better way, but I think this option should also work:
<?php global $i; $i = 0; while ( have_posts() ) : the_post(); ?>
<?php wc_get_template_part( 'content', 'product' ); ?>
<?php $i++; endwhile; // end of the loop. ?>
global $i; echo $i;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question