﻿id,summary,reporter,owner,description,type,status,priority,milestone,component,version,severity,resolution,keywords,cc
18390,apply_filters for a theme's functions.php,ofshard,,"My primary intention with this suggestion is for switching a page's theme on the fly. Currently the only method I know of for this is to change the active theme before functions.php is included and then switching back sometime after, which I don't find very thread safe.

Anyway, I suggest that lines 278-283 in wp-settings.php which currently read:

{{{
if ( ! defined( 'WP_INSTALLING' ) || 'wp-activate.php' === $pagenow ) {
	if ( TEMPLATEPATH !== STYLESHEETPATH && file_exists( STYLESHEETPATH . '/functions.php' ) )
		include( STYLESHEETPATH . '/functions.php' );
	if ( file_exists( TEMPLATEPATH . '/functions.php' ) )
		include( TEMPLATEPATH . '/functions.php' );
}
}}}

be altered to implement the 'theme_functions' and 'theme_parent_functions' filters as below:


{{{
if ( !defined( 'WP_INSTALLING' ) || 'wp-activate.php' === $pagenow ){
	$path = (file_exists(STYLESHEETPATH . '/functions.php')) ? STYLESHEETPATH . '/functions.php' : '';
	$functions = apply_filters('theme_functions', $path);
	if( $functions != '' )
		include($functions);
	
	$path = (TEMPLATEPATH !== STYLESHEETPATH && file_exists(TEMPLATEPATH . '/functions.php')) ? TEMPLATEPATH . '/functions.php' : '';
	$functions = apply_filters('theme_parent_functions', $path);
	if( $functions != '' )
		include($functions);
}
}}}
",enhancement,closed,normal,,Themes,3.2.1,normal,wontfix,close,
