Opened 17 years ago
Closed 9 years ago
#5172 closed enhancement (fixed)
Adding classes to wp_generate_tag_cloud
Reported by: | chmac | Owned by: | boonebgorges |
---|---|---|---|
Milestone: | 4.5 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Taxonomy | Keywords: | has-patch reporter-feedback dev-feedback |
Focuses: | template | Cc: |
Description
The attached patch changes 2 things on the wp_generate_tag_cloud function.
1) The current code uses single quotes instead of double quotes, I believe the standard is to use double quotes. I've converted single quotes to double quotes.
2) I've rounded the tag size to a whole number (no decimal places).
3) I've added a class "tag-cloud-item-X" where X is the number in the list and a second class "tag-cloud-size-X" where X is the size of the tag. . This will allow theme designers to apply different styles to tags. For example changing the colour from cold to hot depending on order or size.
Attachments (3)
Change History (23)
#4
@
17 years ago
+1 for adding some classes
I think we should actually remove the inline styles (font-size) and use classes instead.
Also, while we're adding classes, I think we should add a current_tag class if you're viewing a tag page.
#8
@
15 years ago
- Keywords needs-patch added; has-patch removed
- Milestone changed from 2.9 to Future Release
#9
@
15 years ago
I take my comment over from #8903 for further reference:
- add new function wp_generate_tag_cloud_array() that takes care of data only
- that data should handle the absolute weight (min-max) as well as relative (1-5)
- use the new function on your own will
- update wp_genereate_tag_cloud() to use the new function as well.
going that route will seperate the concerns and refactor wp_generate_tag_cloud() a bit.
#10
@
13 years ago
- Keywords reporter-feedback dev-feedback added; wp_generate_tag_cloudk wp_tag_cloud removed
Are patches (or updates to the existing one) welcome for this issue?
#12
@
9 years ago
- Keywords has-patch added; needs-patch removed
Attached a new patch with code updated for last version of WordPress.
This ticket was mentioned in Slack in #core by mte90. View the logs.
9 years ago
#17
@
9 years ago
- Keywords needs-refresh added; reporter-feedback dev-feedback has-patch removed
The idea behind classes suggested in the patch looks good to me, but the patch needs a refresh after [32996].
'tag-cloud-item-' . count( $a )
feels like a weird class name. The integer doesn't describe the item, it describes the cardinal position (1, 2, 3...) of the tag in the cloud. How about 'tag-cloud-item-position-'
?
There is no standard for quotes style in XHTML. We tend to use doublequotes by default, but we'll use singlequotes if we want to concat in some variables.
e.g.
rather than: