Make WordPress Core

Opened 6 years ago

Closed 6 years ago

#10315 closed feature request (fixed)

Add parameter "separator" to "wp_tag_cloud()"

Reported by: ramiy Owned by:
Milestone: 2.9 Priority: normal
Severity: normal Version: 2.9
Component: Themes Keywords: has-patch
Focuses: Cc:


When using wp_tag_cloud('format=flat') the result is a list of tags separated by whitespace.

The problem: We can't change the whitespace between the tags.

The solution: Adding the "separator" parameter will give us some control over the separator string.

Attachments (3)

10315.patch (1.4 KB) - added by ramiy 6 years ago.
10315.2.patch (1.4 KB) - added by hakre 6 years ago.
Updated patch so that seperator is the only seperator and defaults to the default seperator ("\n").
wp_tag_cloud.separator.10315.diff (1.5 KB) - added by filosofo 6 years ago.

Download all attachments as: .zip

Change History (16)

comment:1 @thee176 years ago

using "between" would be more inline with other functions.

comment:2 @hakre6 years ago

  • Resolution set to wontfix
  • Status changed from new to closed

there is the 'format=array' options. use that to implode with the seperator char of your choice.

somewhat related: #5172

IMHO no need to re-invent the wheel here for a behavior in for some time, so I close this as wontfix. A wordaround is provided anyway.

comment:3 @ramiy6 years ago

  • Keywords needs-patch added
  • Resolution wontfix deleted
  • Status changed from closed to reopened

The problem is that not every one know how to use 'format=array', this is not user friendly!

The "separator" parameter is the most elegant solution to this problem.

comment:4 @hakre6 years ago

Can you please name some other WordPress API functions having such a functionality already? Or is this just a personal preference of yours?

comment:5 @ramiy6 years ago

First of all, this is not a personal preference.

Adding this feature will make WordPress not only developer-friendly but also user-friendly and desingner-friendly. This is not a big technological improvement, this is a tag-cloud output design.

Instead of the current obsolete whitespace between tags blogers can change it to a minus sign or a nice image. Adding a widget control will allow users to edit the separator in the widget sub-panel and will make it even simpler and easier.

@ramiy6 years ago

comment:6 @ramiy6 years ago

  • Keywords has-patch added; needs-patch removed

@hakre6 years ago

Updated patch so that seperator is the only seperator and defaults to the default seperator ("\n").

comment:7 @hakre6 years ago

  • Milestone changed from 2.9 to 2.8.2

Default seperator should be "\n" then. Updated the patch, credits to ramiy.

Additional note: wp_tag_cloud and wp_generate_tag_cloud share a decent amount of code (for example the default values) which does a bit fishy to me. Someone willing to clean that up?

comment:8 @dd326 years ago

  • Milestone changed from 2.8.2 to 2.9

Milestone: Future release pending patch for enhancements, Current-trunk upon patch being added for consideration, point release back-porting at commiters discretion. (Generic reply for when I change the milestone)

comment:9 @westi6 years ago

  • Keywords needs-patch added; has-patch removed
  • Milestone changed from 2.9 to Future Release

Patch is stale needs updating.

comment:10 @filosofo6 years ago

  • Keywords has-patch added; needs-patch removed
  • Milestone changed from Future Release to 2.9
  • Version changed from 2.8 to 2.9

Refreshed patch. :)

comment:11 follow-up: @westi6 years ago

Patch fail - removes code :-(

comment:12 in reply to: ↑ 11 @filosofo6 years ago

Replying to westi:

Patch fail - removes code :-(

Whoops. Updated patch with fix.

comment:13 @westi6 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

(In [12014]) Allow the separator in wp_tag_cloud and wp_generate_tag_cloud to be specified. Fixes #10315 props ramiy and filosofo.

Note: See TracTickets for help on using tickets.