WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 6 years ago

#6504 closed defect (bug) (duplicate)

wp_tag_cloud default unit output (undefined styling / solution)

Reported by: vlogtheimpaler Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.5
Component: Template Keywords: wp_tag_cloud
Focuses: Cc:

Description

I found a possibly unwanted behavior when attempting to dump the inline styles for wp_tag_cloud in one of my current "themes-in-progress". Mainly when the size arguments were left undefined:

wp_tag_cloud('smallest=&largest=&unit=&number=0&orderby=count&format=list');

All the units in this example default to '0', which hides listed tags all together via the inline styles. It seems to apply to lesser-used tags the most as I don't have a sample DB with tons of tags yet to test against. But it could be used to solve a problem at the same time.

I believe that instead of creating a whole new template tag or plug-in, wouldn't it be more useful to just use this as a valid argument to exclude inline styles? This way if units or min/max sizes (or all three as above) are left undefined, wp_tag_cloud can display tags exactly like wp_list_categories for those who don't want inline styles. It may also work some ideas from ticket #5172 if strings could be passed to define class names instead of units.

so something like:

wp_tag_cloud('&unit=0&number=0&orderby=count&format=list'); /* 'unit=&' or 'unit=0& */

could simply exclude inline styles all together where as:

wp_tag_cloud('unit=class&class=xsm,sm,md,lg,xl,xxl&number=0&orderby=count&format=list');

would define the unit type as classes. Then divide the counted number of classes appropriately to be treated as numbered units while pushing class names as numbers.

If there's a plug-in that already does all of this, I haven't found it. But it would be so much easier to have it as a built-in template tag to flexibly display all tags.

Change History (3)

comment:1 @lloydbudd7 years ago

  • Milestone changed from 2.5.1 to 2.6
  • Version set to 2.5

comment:2 @vlogtheimpaler7 years ago

Since nobody has picked this one up yet. I figured I may add that it also might prove useful if you could also output a plain list for use as meta tag keywords.

comment:3 @Denis-de-Bernardy6 years ago

  • Milestone 2.9 deleted
  • Resolution set to duplicate
  • Status changed from new to closed

see #5172

Note: See TracTickets for help on using tickets.