WooCommerce – Custom tag cloud shortcode

This code allows you use a shortcode in your pages to display a tag cloud of your products.

<?php
/**
* Custom WooCommerce tag cloud shortcode.
*
* Use the follow shortcode in your pages: [my_wc_tag_cloud]
*/
function my_custom_wc_tag_cloud_shortcode() {
return wp_tag_cloud( array( 'taxonomy' => 'product_tag', 'echo' => false ) );
}
add_shortcode( 'my_wc_tag_cloud', 'my_custom_wc_tag_cloud_shortcode' );

view raw
functions.php
hosted with ❤ by GitHub