Always display the default header when previewing a theme. Props Viper007Bond. fixes #9152

git-svn-id: http://svn.automattic.com/wordpress/trunk@11061 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2009-04-22 22:32:35 +00:00
parent d90ba6085f
commit 7fd61e13df
1 changed files with 5 additions and 2 deletions

View File

@ -875,15 +875,18 @@ function preview_theme() {
if ( validate_file($_GET['template']) ) if ( validate_file($_GET['template']) )
return; return;
add_filter('template', create_function('', "return '{$_GET['template']}';") ); add_filter( 'template', create_function('', "return '{$_GET['template']}';") );
if ( isset($_GET['stylesheet']) ) { if ( isset($_GET['stylesheet']) ) {
$_GET['stylesheet'] = preg_replace('|[^a-z0-9_./-]|i', '', $_GET['stylesheet']); $_GET['stylesheet'] = preg_replace('|[^a-z0-9_./-]|i', '', $_GET['stylesheet']);
if ( validate_file($_GET['stylesheet']) ) if ( validate_file($_GET['stylesheet']) )
return; return;
add_filter('stylesheet', create_function('', "return '{$_GET['stylesheet']}';") ); add_filter( 'stylesheet', create_function('', "return '{$_GET['stylesheet']}';") );
} }
// Prevent theme mods to current theme being used on theme being previewed
add_filter( 'pre_option_mods_' . get_current_theme(), create_function( '', "return array();" ) );
ob_start( 'preview_theme_ob_filter' ); ob_start( 'preview_theme_ob_filter' );
} }
add_action('setup_theme', 'preview_theme'); add_action('setup_theme', 'preview_theme');