[wp-trac] Re: [WordPress Trac] #5662: Class Ancestor Pages

WordPress Trac wp-trac at lists.automattic.com
Mon Jan 21 01:09:49 GMT 2008


#5662: Class Ancestor Pages
-------------------------------------+--------------------------------------
 Reporter:  AaronCampbell            |        Owner:  anonymous
     Type:  enhancement              |       Status:  new      
 Priority:  normal                   |    Milestone:  2.5      
Component:  General                  |      Version:  2.5      
 Severity:  normal                   |   Resolution:           
 Keywords:  has-patch needs-testing  |  
-------------------------------------+--------------------------------------
Changes (by jeremyclarke):

 * cc: jeremyclarke (added)
  * version:  => 2.5

Comment:

 We discussed this in irc. The problem was that the start_el function from
 classes.php was throwing errors if you checked  $_current_page->ancestors
 when you weren't on a page (because the $_current_page object was empty).
 The solution is just to check that the get_page worked and populated
 $_current_page, similar to how it is done a few lines down for
 post_parent.

 if ($_current_page && in_array($page->ID, $_current_page->ancestors)) {

 the attached diff fixes it. Tested on trunk.

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


More information about the wp-trac mailing list