我發現此代碼(http://devotepress.com/faqs/display-popular-tags-wordpress),並使用了短代碼([wpb_popular_tags]),但沒有看到任何結果。顯示WooCommerce側欄小部件區域中的熱門產品標籤
如何使用此代碼顯示最受歡迎的WooCommerce產品標籤?
這裏是他們的代碼:
function wpb_tag_cloud() {
$tags = get_tags();
$args = array(
'smallest' => 10,
'largest' => 22,
'unit' => 'px',
'number' => 10,
'format' => 'flat',
'separator' => " ",
'orderby' => 'count',
'order' => 'DESC',
'show_count' => 1,
'echo' => false
);
$tag_string = wp_generate_tag_cloud($tags, $args);
return $tag_string;
}
// Add a shortcode so that we can use it in widgets, posts, and pages
add_shortcode('wpb_popular_tags', 'wpb_tag_cloud');
// Enable shortcode execution in text widget
add_filter ('widget_text', 'do_shortcode');
試試這個:http://www.wpbeginner.com/plugins/how-to-display-most-popular-tags-in-wordpress/ –