WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 6 years ago

#5726 closed enhancement (fixed)

Random order argument/Hook in wp_tag_cloud()

Reported by: fitztrev Owned by:
Milestone: 2.5 Priority: normal
Severity: normal Version:
Component: General Keywords: has-patch
Focuses: Cc:

Description

wp_tag_cloud currently accepts 2 'order' arguments: DESC & ASC.

This patch adds 'RAND' capabilities to randomize the order of the tag cloud or list.

Can prevent large font face tags from being next to each other when the user doesn't necessarily want to sort the tags alphabetically.

Usage:

<?php wp_tag_cloud('order=RAND'); ?>

Attachments (2)

rand.diff (498 bytes) - added by fitztrev 6 years ago.
hook1.diff (476 bytes) - added by fitztrev 6 years ago.
wp_tag_counts hook

Download all attachments as: .zip

Change History (5)

fitztrev6 years ago

comment:1 fitztrev6 years ago

  • Keywords has-patch added

comment:2 fitztrev6 years ago

  • Summary changed from Random order argument in wp_tag_cloud() to Random order argument/Hook in wp_tag_cloud()

Another option is to make it pluggable. As it stands now, there is no way to hook into the $counts array between the time it is created and when the html is processed. This may have more uses beyond just reordering the array.

Patch provided.

fitztrev6 years ago

wp_tag_counts hook

comment:3 ryan6 years ago

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

(In [6824]) Add RAND order option to wp_tag_cloud(). Props fitzrev. fixes #5726

Note: See TracTickets for help on using tickets.