/**
* nggTagCloud() - return a tag cloud based on the wp core tag cloud system
*
* @param array $args
* @param string $template (optional) name for a template file, look for gallery-$template
* @return the content
*/
function nggTagCloud($args ='', $template = '') {
global $nggRewrite;
// $_GET from wp_query
$tag = get_query_var('gallerytag');
$pageid = get_query_var('pageid');
// look for gallerytag variable
if ( $pageid == get_the_ID() || !is_home() ) {
if (!empty( $tag )) {
$slug = esc_attr( $tag );
$out = nggShowGalleryTags( $slug );
return $out;
}
}
$defaults = array(
'smallest' => 8, 'largest' => 22, 'unit' => 'pt', 'number' => 45,
'format' => 'flat', 'orderby' => 'name', 'order' => 'ASC',
'exclude' => '', 'include' => '', 'link' => 'view', 'taxonomy' => 'ngg_tag'
);
$args = wp_parse_args( $args, $defaults );
$tags = get_terms( $args['taxonomy'], array_merge( $args, array( 'orderby' => 'count', 'order' => 'DESC' ) ) ); // Always query top tags
foreach ($tags as $key => $tag ) {
$tags[ $key ]->link = $nggRewrite->get_permalink(array ('gallerytag' => $tag->slug));
$tags[ $key ]->id = $tag->term_id;
}
$out = '<div class="ngg-tagcloud">' . wp_generate_tag_cloud( $tags, $args ) . '</div>';
return $out;
}
?>