Opened 17 years ago
Closed 16 years ago
#4552 closed defect (bug) (fixed)
number argument in wp_generate_tag_cloud is not used
Reported by: | pgdx | Owned by: | ryan |
---|---|---|---|
Milestone: | 2.7 | Priority: | normal |
Severity: | normal | Version: | 2.3 |
Component: | Template | Keywords: | tag cloud number wp_tag_cloud has-patch |
Focuses: | Cc: |
Description
When using the wp_tag_cloud function the argument "number" is ignored, specifically in the function wp_generate_tag_cloud.
Attachments (3)
Change History (17)
#4
@
17 years ago
- Resolution fixed deleted
- Status changed from closed to reopened
Leave open till committed
#6
@
17 years ago
While this code does work for me, I was hoping for a method of limiting tags in a tag cloud on a slightly different basis. By just limiting a tag cloud to say 20 tags, for use in a sidebar for example, it just takes out tags from the bottom regardless of their importance. I'm aware that they can be ordered asc/desc and by name/count, but I would like to see a way that retains the tag cloud appearance while limiting the number of tags.
That is, perhaps another parameter, or just the logic to limit tags by not displaying ones that have very few posts associated with them and rescaling the remaining tags' sizes to still have the trademark "tag cloud" appearance
crude mockup to illustrate my jargon: http://paulstamatiou.com/files/tag_cloud_smart.jpg
#7
@
17 years ago
Just added my contribution to this, Its designed to do 3 things:
- Smart clipping by default, Removes items with less number of topics and retains the higher-valued tags, Allows it to retain the same A-Z view, yet limit it to a smaller number of items
- Moved WP Tag links into wp_tag_cloud(), Allows wp_generate_tag_cloud() to be used for other purposes than the WP Tagging functions.
- Further on that previous one, $tags can be an object, or array
Seems to work as i intended, But with all the sorting thats going on :)
#12
@
17 years ago
- Milestone set to 2.4
- Resolution worksforme deleted
- Status changed from closed to reopened
This bug is easily reproducible, just badly described.
wp_generate_tag_cloud() does not use the number argument even though it's in the defaults for the function. Call wp_generate_tag_cloud($tags, "number=1") and you get back more than one tag.
Whether this should be fixed or not is up for debate. As I see it, you should limit the number of tags when you call get_tags(), before passing them to the generator function. This is what wp_tag_cloud() does.
So my suggested fix is simply to remove "number" as an option from the defaults in wp_generate_tag_cloud(). It doesn't use $number anywhere and it seems pointless to do so, if you want less tags, pass in a smaller number of tags to begin with.
Should be fixed with something like this