[wp-trac] [WordPress Trac] #39862: Track the number of children for a walker element scope

WordPress Trac noreply at wordpress.org
Mon Feb 13 17:06:26 UTC 2017


#39862: Track the number of children for a walker element scope
-------------------------+-----------------------------
 Reporter:  AlexGW       |      Owner:
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  Menus        |    Version:  4.7.2
 Severity:  normal       |   Keywords:
  Focuses:               |
-------------------------+-----------------------------
 Unless this had been deliberately omitted for performance reasons?

 A minor change to the {{{Walker}}} class would provide the total number of
 children {{{$this->total_children}}} for the current element scope from
 within the {{{display_element()}}} function.

 Currently a custom walker must be used and include an extension of
 display_element() for each {{{X_Walker}}} class where this information is
 needed.

 Patch attached.

 This change; for example could provide information to display the number
 of replies to a comment in an extended template of
 {{{Comment_Walker::comment()}}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/39862>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list