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

spencerp spencerp1 at gmail.com
Fri Jun 29 20:51:54 GMT 2007


Pål Grønås Drange wrote:
> Pål Grønås Drange wrote:
>> 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
>
> And I created a trac:
>
> http://trac.wordpress.org/ticket/4552
>
> ---pgdx
>

Ok, I finally tried this on the localhost. The tags show only limited 
amount, which is what your patch is intended to do. :D I set the display 
to 40 and it's only showing 40 like supposed to. However, the largest 
and smallest function isn't working. They all small.

Here is what I was using:
<?php wp_tag_cloud('smallest=8&largest=22&number=40&orderby=count'); ?>

Comparing to what you wrote above there, and to your patch, you seemed 
to be missing this end part in your patch:

* ( $smallest + ( ( $count - $min_count ) * $font_step ) )
            . "$unit;'>$tag</a>";
}

*I tried your patch the way it was on your filed ticket, and then added 
that ending part right above there too and nothing. The tags are all 
still small, any thoughts? Maybe it's something I'm not doing correctly? 
Thanks again for your patch though! "We" getting closer! :D

--
spencerp
http://spencerp.net
http://www.vindictivebastard.net





More information about the wp-testers mailing list