[wp-testers] WP Tag Cloud parameter question...

Pål Grønås Drange paal at drange.net
Wed Jun 27 18:56:39 GMT 2007


Pål Grønås Drange wrote:
> spencerp wrote:
>> "However, it doesn't work, and if you look inside the 
>> wp_generate_tag_cloud() function, it doesn't even touch $number.
>> So, I presume the WP guys haven't implemented it yet."
> It touches number with the function wp_parse_args ( line 1288 in 
> wp-includes/functions.php ) and again in wp_generate_tag_cloud.
No, you're absolutely right, my friend. It doesn't touch it. It should 
have done so in the function wp_generate_tag_cloud( $tags, $args = ''), 
but it doesn't.

You can try to do something like this to the foreach in that function:

=================================

$numbers = 0;
foreach ( $counts as $tag => $count ) {
	if ($numbers++ >= $number)
		break;
	$tag_link = clean_url($tag_links[$tag]);
	$tag = str_replace(' ', ' ', wp_specialchars( $tag ));
	$a[] = "<a href='$tag_link' title='" . attribute_escape( sprintf( 
__('%d topics'), $count ) ) . "'$rel style='font-size: " .
             ( $smallest + ( ( $count - $min_count ) * $font_step ) )
             . "$unit;'>$tag</a>";
}

=================================

----pgdx


More information about the wp-testers mailing list