WordPress.org

Make WordPress Core

Changeset 30793


Ignore:
Timestamp:
12/08/2014 10:22:23 PM (6 years ago)
Author:
ocean90
Message:

Themes: Use Customizer deep-links inside the theme modal.

props DrewAPicture, ocean90.
see #25569, #25571.
fixes #30553.

Location:
trunk/src/wp-admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/css/themes.css

    r30747 r30793  
    581581}
    582582
     583/* Hide-if-customize for items we can't add classes to */
     584.customize-support .theme-overlay .theme-actions a[href="themes.php?page=custom-header"],
     585.customize-support .theme-overlay .theme-actions a[href="themes.php?page=custom-background"] {
     586    display: none;
     587}
     588
    583589.broken-themes a.delete-theme,
    584590.theme-overlay .theme-actions .delete-theme {
  • trunk/src/wp-admin/themes.php

    r30697 r30793  
    165165            // 0 = name, 1 = capability, 2 = file
    166166            if ( ( strcmp($self, $item[2]) == 0 && empty($parent_file)) || ($parent_file && ($item[2] == $parent_file)) )
    167                 $class = ' class="current"';
     167                $class = ' current';
    168168            if ( !empty($submenu[$item[2]]) ) {
    169169                $submenu[$item[2]] = array_values($submenu[$item[2]]); // Re-index.
    170170                $menu_hook = get_plugin_page_hook($submenu[$item[2]][0][2], $item[2]);
    171171                if ( file_exists(WP_PLUGIN_DIR . "/{$submenu[$item[2]][0][2]}") || !empty($menu_hook))
    172                     $current_theme_actions[] = "<a class='button button-secondary' href='admin.php?page={$submenu[$item[2]][0][2]}'$class>{$item[0]}</a>";
     172                    $current_theme_actions[] = "<a class='button button-secondary$class' href='admin.php?page={$submenu[$item[2]][0][2]}'>{$item[0]}</a>";
    173173                else
    174                     $current_theme_actions[] = "<a class='button button-secondary' href='{$submenu[$item[2]][0][2]}'$class>{$item[0]}</a>";
    175             } else if ( current_user_can($item[1]) ) {
     174                    $current_theme_actions[] = "<a class='button button-secondary$class' href='{$submenu[$item[2]][0][2]}'>{$item[0]}</a>";
     175            } elseif ( ! empty( $item[2] ) && current_user_can( $item[1] ) ) {
    176176                $menu_file = $item[2];
    177                 if ( false !== ( $pos = strpos( $menu_file, '?' ) ) )
     177
     178                if ( current_user_can( 'customize' ) ) {
     179                    if ( 'custom-header' === $menu_file ) {
     180                        $current_theme_actions[] = "<a class='button button-secondary hide-if-no-customize$class' href='customize.php?autofocus[control]=header_image'>{$item[0]}</a>";
     181                    } elseif ( 'custom-background' === $menu_file ) {
     182                        $current_theme_actions[] = "<a class='button button-secondary hide-if-no-customize$class' href='customize.php?autofocus[control]=background_image'>{$item[0]}</a>";
     183                    }
     184                }
     185
     186                if ( false !== ( $pos = strpos( $menu_file, '?' ) ) ) {
    178187                    $menu_file = substr( $menu_file, 0, $pos );
     188                }
     189
    179190                if ( file_exists( ABSPATH . "wp-admin/$menu_file" ) ) {
    180                     $current_theme_actions[] = "<a class='button button-secondary' href='{$item[2]}'$class>{$item[0]}</a>";
     191                    $current_theme_actions[] = "<a class='button button-secondary$class' href='{$item[2]}'>{$item[0]}</a>";
    181192                } else {
    182                     $current_theme_actions[] = "<a class='button button-secondary' href='themes.php?page={$item[2]}'$class>{$item[0]}</a>";
     193                    $current_theme_actions[] = "<a class='button button-secondary$class' href='themes.php?page={$item[2]}'$>{$item[0]}</a>";
    183194                }
    184195            }
Note: See TracChangeset for help on using the changeset viewer.