[wp-trac] Re: [WordPress Trac] #1277: Extend is_page() to support child_of and decendent_of

WordPress Trac wp-trac at lists.automattic.com
Sun Mar 18 01:36:51 GMT 2007


#1277: Extend is_page() to support child_of and decendent_of
--------------------------------------+-------------------------------------
 Reporter:  astorm                    |        Owner:  rob1n   
     Type:  enhancement               |       Status:  assigned
 Priority:  normal                    |    Milestone:  2.2     
Component:  General                   |      Version:  2.1     
 Severity:  normal                    |   Resolution:          
 Keywords:  dev-feedback 2nd-opinion  |  
--------------------------------------+-------------------------------------
Changes (by rob1n):

  * keywords:  has-patch dev-feedback => dev-feedback 2nd-opinion

Comment:

 I've got two methods to tackling this. (Well, 3, since one can be done in
 two ways...)

 1. Seperate functions. You can call is_page() to know if that page is the
 current page, and then also call is_page_child() to find out whether the
 current page is a child of X page. Also, is_page_descendant(). So,
 example:

 if (is_page(2) || is_page_child(21)) would return true if the current page
 is either ID 2, or a child of page 21.

 2. An argument to achieve the same as method 1. Either have a single
 is_page() argument that can be either what it is now (ID, page title,
 etc.), but can also be a query string so you can return true also if it's
 a child or descendant of another page. The other way of doing this is just
 having separate arguments.

 I'm torn.

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


More information about the wp-trac mailing list