[wp-trac] [WordPress Trac] #31271: Allow is_page_template() to accept an array of templates to check.

WordPress Trac noreply at wordpress.org
Mon Feb 9 19:39:46 UTC 2015


#31271: Allow is_page_template() to accept an array of templates to check.
-------------------------------+-----------------------------
 Reporter:  morganestes        |      Owner:
     Type:  enhancement        |     Status:  new
 Priority:  normal             |  Milestone:  Awaiting Review
Component:  Posts, Post Types  |    Version:  trunk
 Severity:  normal             |   Keywords:
  Focuses:                     |
-------------------------------+-----------------------------
 Currently, `is_page_template()` takes an optional single template name to
 check. This would also allow for an array of strings to check.

 Before:

 {{{
 if ( is_page_template( 'page-one.php' ) || is_page_template( 'page-
 two.php' ) || is_page_template( 'page-four.php' ) ) {
     throw_hhg( false );
  }
 }}}

 After:


 {{{
 if ( is_page_template( array( 'page-one.php' , 'page-two.php',  'page-
 three.php' ) ) ) {
     throw_hhg( true );
 }
 }}}


 Related: #15061

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


More information about the wp-trac mailing list