[wp-trac] [WordPress Trac] #20509: Theme idea - generic.php

WordPress Trac noreply at wordpress.org
Fri Dec 14 00:00:36 UTC 2012


#20509: Theme idea - generic.php
--------------------------------------+------------------------------
 Reporter:  johnjamesjacoby           |       Owner:
     Type:  feature request           |      Status:  new
 Priority:  normal                    |   Milestone:  Awaiting Review
Component:  Themes                    |     Version:
 Severity:  normal                    |  Resolution:
 Keywords:  needs-patch dev-feedback  |
--------------------------------------+------------------------------

Comment (by johnjamesjacoby):

 > Also, what do you mean by plugin-{slug}.php?
 I mean plugin-buddypress.php, plugin-bbpress.php, plugin-post-type-
 switcher.php, etc... Taking the directory name, and using it as a
 fallback... This allows for themes to target specific plugins opt-in,
 conditionally. This allows for stuff like:

 * BuddyPress gets a full-page width template.
 * bbPress gets a forum specific sidebar.

 Plugins are responsible for filling in their own content areas, and even
 the content sidebar area. Common elements should be left alone to the
 theme and WordPress to sort out (header, footer, container, etc...)

 Adding plugin-{slug}.php to the template_include filter is actually pretty
 easy to do in a plugin already (both bbPress and BuddyPress do this) --
 but it would be nice to have a way in core to register a callback that
 determines what those boundaries are to identify when that template should
 get used VS some other one, rather than having to build all of it every
 time.

 This is not unlike the way the template-loader.php file works already;
 just a big if statement that says:

 * Let's look for some conditions...
 * If that thing happens...
 * Load a specific template...
 * In a specific expected order...
 * Unless we don't have anything...
 * Then fallback to index.php.

 We could go as far as making it something that WordPress core uses and
 registers itself. Rather than having a huge if statement, we just register
 filters in priority order to template_include. That cleans up template-
 loader.php down to a few lines of code, and introduces router functions to
 handle the above logic.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/20509#comment:51>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list