Initialize the array into while recent post woocommerce?
When I want to display the latest product
I want to put in an array and show them in one section
only 9 post Initialize.
correct?
<?php
$arry = array("", "", "","", "", "","", "", "");
$params = array('posts_per_page' => 5,'post_type' => 'product');
$wc_query = new WP_Query($params);
?>
<?php if ($wc_query->have_posts()) : ?>
<?php $i =0 ; while ($wc_query->have_posts()) : $wc_query->the_post(); ?>
<?php $array[$i] = the_title(); ?>
<?php $i++; endwhile; ?>
<?php endif; ?>