[wp-trac] [WordPress Trac] #42855: Add ability to filter header, sidebar, searchform, footer and template_part file paths

WordPress Trac noreply at wordpress.org
Sun Feb 18 15:51:58 UTC 2018


#42855: Add ability to filter header, sidebar, searchform, footer and template_part
file paths
------------------------------+------------------------------
 Reporter:  atanasangelovdev  |       Owner:
     Type:  enhancement       |      Status:  new
 Priority:  normal            |   Milestone:  Awaiting Review
Component:  Themes            |     Version:
 Severity:  normal            |  Resolution:
 Keywords:  has-patch         |     Focuses:  template
------------------------------+------------------------------

Comment (by joyously):

 > > The child theme can change it easily ...
 >
 > Yes, you can change the contents of a partial but if you wish to change
 the location of a partial you have to essentially copy-paste the parent
 partial/template and change how it loads the partial you wish to move.

 That is a good thing, not a problem. It is best (for debug, extending, and
 review) that each theme follows the same rules.

 > > ... so it's only plugins that would "benefit" from a filter ...
 >
 > I ended up suggesting this filter because we are building a starter
 theme, not a plugin, and wanted to reorganize the template/view files away
 from dotfiles, library code, classes, assets etc. but could not do so to a
 satisfactory level since core template partials are required to exist and
 are locked to be in the same directory as the style.css file (this is just
 one example).

 That doesn't sound like a valid reason. Each theme is standalone, so what
 does it matter if the header file is in the main folder? It can always be
 found, easily, that way. Consistency is a good thing.

 > > It actually doesn't make sense to me to have get_header() able to get
 something other than the header that the theme defined.
 >
 > It does not necessarily have to be something different. It can be the
 header, just in another place or with a fallback.

 Of course it does not //have// to be different, but with a filter, it
 //could// be different. And that doesn't make much sense. The theme
 decides what is in its header template and also decides when to output it.
 If plugins need to modify the contents, the theme can allow for that, or
 not. Child themes can very easily change what's in the file. Nothing else
 needed.

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


More information about the wp-trac mailing list