Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




preview_theme [ WordPress Function ]

preview_theme ( No parameters )
Defined at:



Start preview theme output buffer.

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

Source


<?php
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_barfalse );

    
$_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_theme_mods_' get_option'stylesheet' ), '__return_empty_array' );

    
ob_start'preview_theme_ob_filter' );
}
?>

Examples [ wp-snippets.com ]

Google Arama Sonuçlarý

Dahasý ...

0 User Note(s)

Henüz yok. Ýlk sen ol!

Yeni Ekle ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics