Add class name to WooCommerce product loop

<?php // get 1st item add alpha class if ($woocommerce_loop['loop'] % 1 === 0) { $classes[] = 'alpha'; } // get every third item add class omega if ($woocommerce_loop['loop'] % 3 === 0) { $classes[] = 'omega'; } // get every fourt item add class alpha if ($woocommerce_loop['loop'] % 4 === 0) { $classes[] = 'alpha'; }
Add class names to the loop output from WooCommerce product loop

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.