PHP API

By default the function tag_groups_cloud returns the html for a tabbed tag cloud. If you want to add the tag cloud directly into your theme, you could do it like this:

if ( function_exists( 'tag_groups_cloud' ) ) echo tag_groups_cloud( array( 'amount' => 10 ) );

The array can, of course, contain also more parameters:

array( 'include' => '1,2,5,6', 'amount' => 10 )

If the optional second parameter is set to ‘true’, the function will return a multidimensional array containing tag groups and tags:

 if ( function_exists( 'tag_groups_cloud' ) ) print_r( tag_groups_cloud( array( 'orderby' => 'count', 'order' => 'DESC' ) , true ) );

Render a shortcode

Use do_shortcode to render a shortcode. Please note that this doesn’t automatically load the scripts that are needed for some features.

echo do_shortcode('[tag_groups_cloud include="6"]');

Other Functions

post_in_tag_group( $post_id, $tag_group_id )

The funciton post_in_tag_group checks whether the post with the givenĀ $post_id has at least one tag that is part of the tag group with the givenĀ $tag_group_id. The return value is true or false.

How do you rate this article?