Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function wp_tag_cloud( $args = '' ) {
- $defaults = array(
- 'smallest' => 8, 'largest' => 22, 'unit' => 'pt', 'number' => 45,
- 'format' => 'flat', 'separator' => "\n", 'orderby' => 'name', 'order' => 'ASC',
- 'exclude' => '', 'include' => '', 'link' => 'view', 'taxonomy' => 'post_tag', 'echo' => true
- );
- $args = wp_parse_args( $args, $defaults );
- $tags = get_terms( $args['taxonomy'], array_merge( $args, array( 'orderby' => 'count', 'order' => 'DESC' ) ) ); // Always query top tags
- if ( empty( $tags ) || is_wp_error( $tags ) )
- return;
- foreach ( $tags as $key => $tag ) {
- if ( 'edit' == $args['link'] )
- $link = get_edit_tag_link( $tag->term_id, $tag->taxonomy );
- else
- $link = get_term_link( intval($tag->term_id), $tag->taxonomy );
- if ( is_wp_error( $link ) )
- return false;
- $tags[ $key ]->link = $link;
- $tags[ $key ]->id = $tag->term_id;
- }
- $return = wp_generate_tag_cloud( $tags, $args ); // Here's where those top tags get sorted according to $args
- $return = apply_filters( 'wp_tag_cloud', $return, $args );
- if ( 'array' == $args['format'] || empty($args['echo']) )
- return $return;
- echo $return;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement