mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-07-07 10:40:11 +00:00
Add theme browsing and theme switching to the Customizer
* Brings into core the Customizer Theme Switcher feature plugin * You can now browse, preview, and activate themes right from the Customizer fixes #31303. props celloexpressions, afercia, westonruter, folletto, designsimply git-svn-id: https://develop.svn.wordpress.org/trunk@31533 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -1110,6 +1110,38 @@ final class WP_Customize_Manager {
|
||||
$this->register_control_type( 'WP_Customize_Upload_Control' );
|
||||
$this->register_control_type( 'WP_Customize_Image_Control' );
|
||||
$this->register_control_type( 'WP_Customize_Background_Image_Control' );
|
||||
$this->register_control_type( 'WP_Customize_Theme_Control' );
|
||||
|
||||
/* Themes */
|
||||
|
||||
$this->add_section( new WP_Customize_Themes_Section( $this, 'themes', array(
|
||||
'title' => sprintf( __( 'Theme: %s' ), $this->theme()->display('Name') ),
|
||||
'capability' => 'switch_themes',
|
||||
'priority' => 0,
|
||||
) ) );
|
||||
|
||||
// Themes Setting (unused - the theme is considerably more fundamental to the Customizer experience).
|
||||
$this->add_setting( new WP_Customize_Filter_Setting( $this, 'active_theme', array(
|
||||
'capability' => 'switch_themes',
|
||||
) ) );
|
||||
|
||||
require_once( ABSPATH . 'wp-admin/includes/theme.php' );
|
||||
|
||||
// Theme Controls.
|
||||
$themes = wp_prepare_themes_for_js();
|
||||
foreach ( $themes as $theme ) {
|
||||
$theme_id = 'theme_' . $theme['id'];
|
||||
$this->add_control( new WP_Customize_Theme_Control( $this, $theme_id, array(
|
||||
'theme' => $theme,
|
||||
'section' => 'themes',
|
||||
'settings' => 'active_theme',
|
||||
) ) );
|
||||
}
|
||||
|
||||
$this->add_control( new WP_Customize_New_Theme_Control( $this, 'add_theme', array(
|
||||
'section' => 'themes',
|
||||
'settings' => 'active_theme',
|
||||
) ) );
|
||||
|
||||
/* Site Title & Tagline */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user