[wp-trac] [WordPress Trac] #40969: RFE: get_template_part() to return something or warn when nothing found

WordPress Trac noreply at wordpress.org
Sat Feb 16 21:33:28 UTC 2019


#40969: RFE: get_template_part() to return something or warn when nothing found
-----------------------------------------+-----------------------
 Reporter:  sphakka                      |       Owner:  pento
     Type:  enhancement                  |      Status:  reopened
 Priority:  normal                       |   Milestone:  5.2
Component:  Themes                       |     Version:
 Severity:  normal                       |  Resolution:
 Keywords:  close has-patch 2nd-opinion  |     Focuses:  template
-----------------------------------------+-----------------------
Changes (by tferry):

 * keywords:  close => close has-patch 2nd-opinion


Comment:

 Thanks @johnbillion, I like your suggestion of a new function - it solves
 the original problem while avoiding the issues of changing the return
 value of the existing function, as discovered. I have attached a diff with
 this new function for review.

 I considered creating equivalent `has_*()` functions for `get_header()`,
 `get_sidebar()`, and `get_footer()` respectively, but the use of the
 theme-compat files in the `locate_template()` function renders these new
 functions redundant - they would all return true, regardless of theme
 files.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/40969#comment:22>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list