WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 12 months ago

#16125 closed enhancement (fixed)

Tag cloud widget: hide dropdown when there's only one taxonomy

Reported by: GautamGupta Owned by: GautamGupta
Milestone: 4.4 Priority: normal
Severity: normal Version: 3.1
Component: Widgets Keywords: has-patch
Focuses: Cc:

Description (last modified by scribu)

We should use get_taxonomies() instead of get_object_taxonomies(). Attaching a patch. [20285]

When there's only one taxonomy to select from, we shouldn't show the dropdown at all.

Attachments (5)

widget-tagcloud.diff (902 bytes) - added by GautamGupta 6 years ago.
tag_cloud.diff (3.6 KB) - added by GautamGupta 6 years ago.
tagcloud.v3.diff (5.2 KB) - added by gautamgupta 5 years ago.
Based on westi's recommendations
16125.diff (3.0 KB) - added by wonderboymusic 12 months ago.
16125.2.diff (4.2 KB) - added by wonderboymusic 12 months ago.

Download all attachments as: .zip

Change History (28)

#1 @GautamGupta
6 years ago

  • Cc gautam.2011@… added
  • Status changed from new to accepted

#2 @nacin
6 years ago

  • Keywords tested removed
  • Type changed from defect (bug) to enhancement

Related: #11612. This is an additional enhancement past that.

I would love to hide the dropdown (make it input:hidden so it still saves) when there is only one taxonomy that supports a tag cloud. Less UI for the win.

#3 @mdawaffe
6 years ago

  • Milestone changed from Awaiting Review to Future Release

#4 @kcssm
6 years ago

This ticket is 3 months old and its way before wordpress-3.1 was released, still this issue is not addressed in this new version. Hope this gets addressed in the next update to come.

#5 @GautamGupta
6 years ago

  • Keywords bbpress added

#6 @nacin
6 years ago

I would love to hide the dropdown (make it input:hidden so it still saves) when there is only one taxonomy that supports a tag cloud. Less UI for the win.

Would like a patch to implement this.

#7 @GautamGupta
6 years ago

Attached another patch based on nacin's recommendations.

Should we return 'post_tag' in _get_current_taxonomy() if no taxonomy was found saved in the options?

#8 @johnjamesjacoby
5 years ago

  • Keywords needs-testing added

Would be helpful for bbPress 2.0 to inherit this instead of including it's own duplicate widget.

Added the needs testing keyword as it's been 6 months since it's had attention.

#9 @SergeyBiryukov
5 years ago

  • Milestone changed from Future Release to 3.3

#10 @westi
5 years ago

  • Keywords needs-refresh added

I kicked the tires on this patch and here is some feedback:

  • Works nicely as I remove taxonomies till none are available.
  • The text displayed in the widget when none are available could do with some copy editing to improve it.
  • The whole patch could do with some work to match coding standards for things like spacing inside of function calls, around !, the whole switch statement.
  • (Personal Taste) I'm not a big fan of the way the switch statement ends up laid out with all the switching back and forth between php and html. I wonder if it might read easier to use echo's instead.

Adding 'needs-refresh' to get the patch updated.

@gautamgupta
5 years ago

Based on westi's recommendations

#11 @gautamgupta
5 years ago

I've attached a new patch based on westi's recommendations. I've also removed the fallback to the post tag taxonomy if no taxonomies are found as if it was hid due to some reason from the tag cloud, we should be acknowledging that.

#12 @SergeyBiryukov
5 years ago

  • Keywords needs-refresh removed

#13 @jane
5 years ago

  • Keywords dev-feedback added

If this is making it into 3.3, it needs to be committed now, as we have passed freeze. If it's not ready to be committed, punt to next cycle.

#14 @navjotjsingh
5 years ago

  • Cc navjotjsingh@… added

#15 @ryan
5 years ago

  • Milestone changed from 3.3 to Future Release

Punting enhancements from 3.3.

#16 @nacin
5 years ago

In [20285]:

Use get_taxonomies() instead of get_object_taxonomies() in the tag cloud widget. props GautamGupta, scribu. see #20238, see #16125.

#17 @nacin
5 years ago

I unintentionally derailed this ticket in comment 2. Hence [20285].

#18 @scribu
5 years ago

  • Description modified (diff)
  • Summary changed from Tag cloud widget should allow any taxonomy (with show_tagcloud arg) to be shown to Tag cloud widget: hide dropdown when there's only one taxonomy

Trying to salvage this ticket somehow.

#19 follow-up: @wlindley
4 years ago

Grammatical error in tagcloud.v3.diff --currently:

'The tag cloud would not be displayed since their are no taxonomies...

should be 'there':

'The tag cloud would not be displayed since there are no taxonomies...

Any chance of getting at least the one-line patch from [20285] into 3.4? Without that, taxonomies cannot even use the standard Tag Cloud widget.

#20 in reply to: ↑ 19 @SergeyBiryukov
4 years ago

Replying to wlindley:

Any chance of getting at least the one-line patch from [20285] into 3.4?

Yes, it's already committed.

#21 @wonderboymusic
15 months ago

  • Keywords needs-patch added; has-patch bbpress needs-testing dev-feedback removed

#22 @wonderboymusic
12 months ago

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

#23 @wonderboymusic
12 months ago

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

In 34273:

Widgets: don't show a dropdown if there is only 1 taxonomy or zero taxonomies available to the Tag Cloud widget form. Don't output the widget if there are no terms in the selected taxonomy.

Props GautamGupta, wonderboymusic.
Fixes #16125.

Note: See TracTickets for help on using tickets.