Observe the following code:
<ul>
<?php wpsc_start_category_query(array('category_group'=>get_option('wpsc_default_category'),'show_thumbnails'=>get_option('show_category_thumbnails'))); ?>
<li>
<div>
<div class="image"><?php wpsc_print_category_image(); ?></div>
<div class="caption-title transparent_class">
<?php wpsc_print_category_name();?>
</div>
<div class="caption transparent_class">
<a href="<?php wpsc_print_category_url();?>" class="wpsc_category_link"><?php wpsc_print_category_name();?></a>
<?php if(get_option('wpsc_category_description')) :?>
<?php wpsc_print_category_description("<div class='wpsc_subcategory'>", "</div>"); ?>
<?php endif;?>
</div>
</div>
</li>
<?php wpsc_end_category_query(); ?>
</ul>
The above code displays all my product categories in a list. The problem with this approach is that I am not able to limit the number of categories that results. For example if I want to display 4 random categories, but have 6 in my WP database, then I won't get what I want.
Is there any alternate way to get the an x
number of categories from all possiblities? Maybe with WP_Query
?