mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-04 04:34:31 +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:
@@ -650,14 +650,33 @@ function wp_admin_bar_comments_menu( $wp_admin_bar ) {
|
||||
function wp_admin_bar_appearance_menu( $wp_admin_bar ) {
|
||||
$wp_admin_bar->add_group( array( 'parent' => 'site-name', 'id' => 'appearance' ) );
|
||||
|
||||
if ( current_user_can( 'switch_themes' ) || current_user_can( 'edit_theme_options' ) )
|
||||
$wp_admin_bar->add_menu( array( 'parent' => 'appearance', 'id' => 'themes', 'title' => __('Themes'), 'href' => admin_url('themes.php') ) );
|
||||
|
||||
if ( ! current_user_can( 'edit_theme_options' ) )
|
||||
return;
|
||||
|
||||
$current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
|
||||
$customize_url = add_query_arg( 'url', urlencode( $current_url ), wp_customize_url() );
|
||||
|
||||
if ( current_user_can( 'switch_themes' ) ) {
|
||||
$wp_admin_bar->add_menu( array(
|
||||
'parent' => 'appearance',
|
||||
'id' => 'themes',
|
||||
'title' => __( 'Themes' ),
|
||||
'href' => admin_url( 'themes.php' ),
|
||||
'meta' => array(
|
||||
'class' => 'hide-if-customize',
|
||||
),
|
||||
) );
|
||||
|
||||
if ( current_user_can( 'customize' ) ) {
|
||||
$wp_admin_bar->add_menu( array(
|
||||
'parent' => 'appearance',
|
||||
'id' => 'customize-themes',
|
||||
'title' => __( 'Themes' ),
|
||||
'href' => add_query_arg( urlencode( 'autofocus[section]' ), 'themes', $customize_url ), // urlencode() needed due to #16859
|
||||
'meta' => array(
|
||||
'class' => 'hide-if-no-customize',
|
||||
),
|
||||
) );
|
||||
}
|
||||
}
|
||||
|
||||
if ( current_user_can( 'customize' ) ) {
|
||||
$wp_admin_bar->add_menu( array(
|
||||
'parent' => 'appearance',
|
||||
@@ -671,6 +690,10 @@ function wp_admin_bar_appearance_menu( $wp_admin_bar ) {
|
||||
add_action( 'wp_before_admin_bar_render', 'wp_customize_support_script' );
|
||||
}
|
||||
|
||||
if ( ! current_user_can( 'edit_theme_options' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( current_theme_supports( 'widgets' ) ) {
|
||||
$wp_admin_bar->add_menu( array(
|
||||
'parent' => 'appearance',
|
||||
|
||||
Reference in New Issue
Block a user