[wp-trac] [WordPress Trac] #8132: calls to default theme should be
modular
WordPress Trac
wp-trac at lists.automattic.com
Mon Nov 10 02:15:04 GMT 2008
#8132: calls to default theme should be modular
---------------------+------------------------------------------------------
Reporter: oaoao | Owner: anonymous
Type: defect | Status: new
Priority: normal | Milestone: 2.7
Component: General | Version:
Severity: normal | Keywords:
---------------------+------------------------------------------------------
themes/default/...
is called in several places, and is hard-coded:
function get_header() {
do_action( 'get_header' );
if ( file_exists( TEMPLATEPATH . '/header.php') )
load_template( TEMPLATEPATH . '/header.php');
else
load_template( WP_CONTENT_DIR .
'/themes/default/header.php');
}
this ruins any modularity one might desire in temporarily relocating
default for one user, one file, etc. additionally, default/ is part of the
svn tree and overriding the files is not ideal.
i recommend moving all calls to default theme files through something more
akin to the already-existing get_query_template(), which is passed through
a filter:
if ( file_exists(TEMPLATEPATH . "/{$type}.php") )
$template = TEMPLATEPATH . "/{$type}.php";
return apply_filters("{$type}_template", $template);
which could possibly be as easy as:
foreach(Array('404', 'archive', 'author', 'category', 'tag',
'taxonomy', 'date', 'home', 'page', 'paged', 'search', 'single',
'attachment', 'comments_popup') as $k)
{
add_filter($k."_template", create_function('$t', 'return
try_default_theme($t,'.$k.');'));
}
function try_default_theme($template, $type){
if ( !$template && file_exists(get_theme_root() .
"/default/{$type}.php") )
$template = get_theme_root() .
"/default/{$type}.php";
return $template;
}
--
Ticket URL: <http://trac.wordpress.org/ticket/8132>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list