[wp-trac] Re: [WordPress Trac] #7743: add paging in class walker

WordPress Trac wp-trac at lists.automattic.com
Mon Sep 15 23:53:06 GMT 2008


#7743: add paging in class walker
-------------------------+--------------------------------------------------
 Reporter:  hailin       |        Owner:  anonymous
     Type:  enhancement  |       Status:  new      
 Priority:  normal       |    Milestone:  2.7      
Component:  General      |      Version:           
 Severity:  normal       |   Resolution:           
 Keywords:               |  
-------------------------+--------------------------------------------------
Comment (by hailin):

 Implemented approach number 2.

 To use it:
 First get the total num of root elements:

 $root_num = $walker->get_number_of_root_elements( $elements );

 Then, decide on the page_num, per_page, and call paged_walk.

 Eg, suppose $root_num = 35, and per_page = 10, so there are 4 pages:

 $walker->paged_walk( $elements, $max_depth, 1, 10, other_args_if_any );
 $walker->paged_walk( $elements, $max_depth, 2, 10, other_args_if_any );
 $walker->paged_walk( $elements, $max_depth, 3, 10, other_args_if_any );
 $walker->paged_walk( $elements, $max_depth, 4, 10,  other_args_if_any );

-- 
Ticket URL: <http://trac.wordpress.org/ticket/7743#comment:1>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list