WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 6 years ago

Last modified 6 years ago

#5004 closed enhancement (duplicate)

Allow Setting The Depth On wp_list_categories

Reported by: intoxination Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.3
Component: General Keywords: category depth has-patch dev-feedback
Focuses: Cc:

Description

Attached is a path to add a depth query argument for wp_list_categories. It defaults to 0 which will walk the entire hierarchy. If hierarchical=false then the flat list is given and depth is ignored.

Attachments (1)

categorydepth.diff (764 bytes) - added by intoxination 7 years ago.

Download all attachments as: .zip

Change History (8)

intoxination7 years ago

comment:1 intoxination7 years ago

  • Type changed from defect to enhancement

comment:2 foolswisdom7 years ago

  • Milestone set to 2.4

comment:3 palamedes6 years ago

It looks like this has been "Mostly" implemented with one minor change.

Change line 292 to;

$depth = $rdepth?; Walk requested depth (0 being full depth).

This way the user can actually specify the depth they want it to be walked via the argument. Otherwise it was just 0 or -1 which doesn't actually do what this RFE had intended.

(Heres the diff since I'm not sure how you guys want it..)

[palamedes]$ diff category-template.php category-template.php.old
253c253

< 'echo' => 1, 'depth' => 0

---

'echo' => 1

292c292

< $depth = $rdepth?; Walk requested depth (0 being full depth).

---

$depth = 0; Walk the full depth.

comment:4 palamedes6 years ago

Note: the post got corrupted when I submitted it. I'll attach a file with the diff.

comment:5 palamedes6 years ago

Hrmm don't have permission to.. okay lets try this;

diff category-template.php category-template.php.bak 

253c253
<               'echo' => 1, 'depth' => 0
---
>               'echo' => 1

292c292
<                       $depth = $r['depth'];  // Walk requested depth (0 being full depth).
---
>                       $depth = 0;  // Walk the full depth.

comment:6 pishmishy6 years ago

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

Duplicates #2461. Patches are pretty much identical too =)

comment:7 lloydbudd6 years ago

  • Milestone 2.5 deleted
Note: See TracTickets for help on using tickets.