is_theme_active example

'description' => $description,
            )
        );

        $choices = array( '0' => __( '— Select —' ) );
        foreach ( $menus as $menu ) {
            $choices[ $menu->term_id ] = wp_html_excerpt( $menu->name, 40, '…' );
        }

        // Attempt to re-map the nav menu location assignments when previewing a theme switch.         $mapped_nav_menu_locations = array();
        if ( ! $this->manager->is_theme_active() ) {
            $theme_mods = get_option( 'theme_mods_' . $this->manager->get_stylesheet(), array() );

            // If there is no data from a previous activation, start fresh.             if ( empty( $theme_mods['nav_menu_locations'] ) ) {
                $theme_mods['nav_menu_locations'] = array();
            }

            $mapped_nav_menu_locations = wp_map_nav_menu_locations( $theme_mods['nav_menu_locations']$this->original_nav_menu_locations );
        }

        foreach ( $locations as $location => $description ) {
            


        if ( ! headers_sent() ) {
            send_origin_headers();
        }

        // Hide the admin bar if we're embedded in the customizer iframe.         if ( $this->messenger_channel ) {
            show_admin_bar( false );
        }

        if ( $this->is_theme_active() ) {
            // Once the theme is loaded, we'll validate it.             add_action( 'after_setup_theme', array( $this, 'after_setup_theme' ) );
        } else {
            /* * If the requested theme is not the active theme and the user doesn't have * the switch_themes cap, bail. */
            if ( ! current_user_can( 'switch_themes' ) ) {
                $this->wp_die( -1, __( 'Sorry, you are not allowed to edit theme options on this site.' ) );
            }

            

    public function override_sidebars_widgets_for_theme_switch() {
        global $sidebars_widgets;

        if ( $this->manager->doing_ajax() || $this->manager->is_theme_active() ) {
            return;
        }

        $this->old_sidebars_widgets = wp_get_sidebars_widgets();
        add_filter( 'customize_value_old_sidebars_widgets_data', array( $this, 'filter_customize_value_old_sidebars_widgets_data' ) );
        $this->manager->set_post_value( 'old_sidebars_widgets_data', $this->old_sidebars_widgets ); // Override any value cached in changeset.
        // retrieve_widgets() looks at the global $sidebars_widgets.         $sidebars_widgets = $this->old_sidebars_widgets;
        $sidebars_widgets = retrieve_widgets( 'customize' );
        add_filter( 'option_sidebars_widgets', array( $this, 'filter_option_sidebars_widgets_for_theme_switch' ), 1 );
        
?> </head> <body class="<?php echo esc_attr( $body_class ); ?>"> <div class="wp-full-overlay expanded"> <form id="customize-controls" class="wrap wp-full-overlay-sidebar"> <div id="customize-header-actions" class="wp-full-overlay-header"> <?php             $compatible_wp  = is_wp_version_compatible( $wp_customize->theme()->get( 'RequiresWP' ) );
            $compatible_php = is_php_version_compatible( $wp_customize->theme()->get( 'RequiresPHP' ) );
            ?> <?php if ( $compatible_wp && $compatible_php ) : ?> <?php $save_text = $wp_customize->is_theme_active() ? __( 'Publish' ) : __( 'Activate &amp; Publish' ); ?> <div id="customize-save-button-wrapper" class="customize-save-button-wrapper" > <?php submit_button( $save_text, 'primary save', 'save', false ); ?> <button id="publish-settings" class="publish-settings button-primary button dashicons dashicons-admin-generic" aria-label="<?php esc_attr_e( 'Publish Settings' ); ?>" aria-expanded="false" disabled></button> </div> <?php else : ?> <?php $save_text = _x( 'Cannot Activate', 'theme' ); ?> <div id="customize-save-button-wrapper" class="customize-save-button-wrapper disabled" > <button class="button button-primary disabled" aria-label="<?php esc_attr_e( 'Publish Settings' ); ?>" aria-expanded="false" disabled><?php echo $save_text; ?></button> </div> <?php endif; ?> <span class="spinner"></span> <button type="button" class="customize-controls-preview-toggle"> <span class="controls">

    protected function render_template() {
        ?> <li id="accordion-section-{{ data.id }}" class="accordion-section control-panel-themes"> <h3 class="accordion-section-title"> <?php                 if ( $this->manager->is_theme_active() ) {
                    echo '<span class="customize-action">' . __( 'Active theme' ) . '</span> {{ data.title }}';
                } else {
                    echo '<span class="customize-action">' . __( 'Previewing theme' ) . '</span> {{ data.title }}';
                }
                ?> <?php if ( current_user_can( 'switch_themes' ) ) : ?> <button type="button" class="button change-theme" aria-label="<?php esc_attr_e( 'Change theme' ); ?>"><?php _ex( 'Change', 'theme' ); ?></button> <?php endif; ?> </h3> <ul class="accordion-sub-container control-panel-content"></ul> </li>
Home | Imprint | This part of the site doesn't use cookies.