Make WordPress Core

Opened 8 years ago

Closed 8 years ago

Last modified 8 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:


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 8 years ago.

Download all attachments as: .zip

Change History (8)

@intoxination8 years ago

comment:1 @intoxination8 years ago

  • Type changed from defect to enhancement

comment:2 @foolswisdom8 years ago

  • Milestone set to 2.4

comment:3 @palamedes8 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

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


'echo' => 1


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


$depth = 0; Walk the full depth.

comment:4 @palamedes8 years ago

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

comment:5 @palamedes8 years ago

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

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

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

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

comment:6 @pishmishy8 years ago

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

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

comment:7 @lloydbudd8 years ago

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