Skip to content

Instantly share code, notes, and snippets.

@filipecsweb
filipecsweb / functions.php
Last active April 14, 2024 18:09
WooCommerce shortcode to output product categories randomly
<?php
/**
* Create the new WooCommerce shortcode [random_product_categories] to output product categories randomly.
* Based on [product_categories] (/plugins/woocommerce/includes/class-wc-shortcodes.php).
*
* This new shortcode accepts all attributes used by [product_categories], except 'orderby' and 'order', of course.
* See more at @link https://woocommerce.com/document/woocommerce-shortcodes/.
*
* @param array $atts User defined attributes in shortcode tag.
*/