Tag Cloud Shortcode
-
Hey guys, I tried creating a custom tag cloud shortcode, but it’s not showing the tags on the front of my site. Here’s the code I’m dropping into my functions.php file:
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');
The page I need help with: [log in to see the link]
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘Tag Cloud Shortcode’ is closed to new replies.