Advertisements

preview_theme

Definition:
function preview_theme() {}

Start preview theme output buffer.
Will only preform task if the user has permissions and template and preview query variables exist.

Source code

function preview_theme() {

	if ( ! (isset($_GET['template']) && isset($_GET['preview'])) )

		return;



	if ( !current_user_can( 'switch_themes' ) )

		return;



	// Admin Thickbox requests

	if ( isset( $_GET['preview_iframe'] ) )

		show_admin_bar( false );



	$_GET['template'] = preg_replace('|[^a-z0-9_./-]|i', '', $_GET['template']);



	if ( validate_file($_GET['template']) )

		return;



	add_filter( 'template', '_preview_theme_template_filter' );



	if ( isset($_GET['stylesheet']) ) {

		$_GET['stylesheet'] = preg_replace('|[^a-z0-9_./-]|i', '', $_GET['stylesheet']);

		if ( validate_file($_GET['stylesheet']) )

			return;

		add_filter( 'stylesheet', '_preview_theme_stylesheet_filter' );

	}



	// Prevent theme mods to current theme being used on theme being previewed

	add_filter( 'pre_option_mods_' . get_current_theme(), '__return_empty_array' );



	ob_start( 'preview_theme_ob_filter' );

}

2605

Advertisements

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: