[wp-trac] [WordPress Trac] #3566: Request for new function get_page_parents

WordPress Trac wp-trac at lists.automattic.com
Fri Jan 12 02:03:36 GMT 2007


#3566: Request for new function get_page_parents
-------------------------+--------------------------------------------------
 Reporter:  snakefoot    |       Owner:  anonymous                                                       
     Type:  enhancement  |      Status:  new                                                             
 Priority:  normal       |   Milestone:  2.2                                                             
Component:  General      |     Version:  2.0                                                             
 Severity:  normal       |    Keywords:  get_category_parents get_page_parents wp_list_pages wp_list_cats
-------------------------+--------------------------------------------------
 Like there is a get_category_parents, then it would be nice with a
 get_page_parents:

 {{{
 function get_page_parents($id, $link = FALSE, $separator = '/', $nicename
 = FALSE){
         $chain = '';
         $parent = &get_page($id);

         if ( $nicename )
                 $name = $parent->post_title;
         else
                 $name = $parent->post_name;

         if ( $parent->post_parent )
                 $chain .= get_page_parents($parent->post_parent, $link,
 $separator, $nicename);

         if ( $link )
                 $chain .= '<a href="' . get_page_link($parent->ID) . '"
 title="' . $parent->post_title . '">'.$name.'</a>' . $separator;
         else
                 $chain .= $name.$separator;
         return $chain;
 }
 }}}

-- 
Ticket URL: <http://trac.wordpress.org/ticket/3566>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list