WordPress.org

Make WordPress Core


Ignore:
Timestamp:
10/19/2017 06:09:16 PM (4 years ago)
Author:
westonruter
Message:

Customize: Fix alignment of Customize, Activate, and Live Preview buttons appearing on the Themes admin screen.

Amends [41893].
Props Mahvash-Fatima.
See #42215.
Fixes #42275.

File:
1 edited

Legend:

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

    r41878 r41949  
    274274    <div class="theme-author"><?php printf( __( 'By %s' ), $theme['author'] ); ?></div>
    275275
    276     <?php if ( $theme['active'] ) { ?>
    277         <h2 class="theme-name" id="<?php echo $aria_name; ?>">
     276    <div class="theme-id-container">
     277        <?php if ( $theme['active'] ) { ?>
     278            <h2 class="theme-name" id="<?php echo $aria_name; ?>">
     279                <?php
     280                /* translators: %s: theme name */
     281                printf( __( '<span>Active:</span> %s' ), $theme['name'] );
     282                ?>
     283            </h2>
     284        <?php } else { ?>
     285            <h2 class="theme-name" id="<?php echo $aria_name; ?>"><?php echo $theme['name']; ?></h2>
     286        <?php } ?>
     287
     288        <div class="theme-actions">
     289        <?php if ( $theme['active'] ) { ?>
     290            <?php if ( $theme['actions']['customize'] && current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) { ?>
     291                <a class="button button-primary customize load-customize hide-if-no-customize" href="<?php echo $theme['actions']['customize']; ?>"><?php _e( 'Customize' ); ?></a>
     292            <?php } ?>
     293        <?php } else { ?>
    278294            <?php
    279             /* translators: %s: theme name */
    280             printf( __( '<span>Active:</span> %s' ), $theme['name'] );
     295            /* translators: %s: Theme name */
     296            $aria_label = sprintf( _x( 'Activate %s', 'theme' ), '{{ data.name }}' );
    281297            ?>
    282         </h2>
    283     <?php } else { ?>
    284         <h2 class="theme-name" id="<?php echo $aria_name; ?>"><?php echo $theme['name']; ?></h2>
    285     <?php } ?>
    286 
    287     <div class="theme-actions">
    288 
    289     <?php if ( $theme['active'] ) { ?>
    290         <?php if ( $theme['actions']['customize'] && current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) { ?>
    291             <a class="button button-primary customize load-customize hide-if-no-customize" href="<?php echo $theme['actions']['customize']; ?>"><?php _e( 'Customize' ); ?></a>
     298            <a class="button activate" href="<?php echo $theme['actions']['activate']; ?>" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _e( 'Activate' ); ?></a>
     299            <?php if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) { ?>
     300                <a class="button button-primary load-customize hide-if-no-customize" href="<?php echo $theme['actions']['customize']; ?>"><?php _e( 'Live Preview' ); ?></a>
     301            <?php } ?>
    292302        <?php } ?>
    293     <?php } else { ?>
    294         <?php
    295         /* translators: %s: Theme name */
    296         $aria_label = sprintf( _x( 'Activate %s', 'theme' ), '{{ data.name }}' );
    297         ?>
    298         <a class="button activate" href="<?php echo $theme['actions']['activate']; ?>" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _e( 'Activate' ); ?></a>
    299         <?php if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) { ?>
    300             <a class="button button-primary load-customize hide-if-no-customize" href="<?php echo $theme['actions']['customize']; ?>"><?php _e( 'Live Preview' ); ?></a>
    301         <?php } ?>
    302     <?php } ?>
    303 
     303
     304        </div>
    304305    </div>
    305306</div>
     
    408409    </div>
    409410
    410     <# if ( data.active ) { #>
    411         <h2 class="theme-name" id="{{ data.id }}-name">
    412             <?php
    413             /* translators: %s: Theme name */
    414             printf( __( '<span>Active:</span> %s' ), '{{{ data.name }}}' );
    415             ?>
    416         </h2>
    417     <# } else { #>
    418         <h2 class="theme-name" id="{{ data.id }}-name">{{{ data.name }}}</h2>
    419     <# } #>
    420 
    421     <div class="theme-actions">
     411    <div class="theme-id-container">
    422412        <# if ( data.active ) { #>
    423             <# if ( data.actions.customize ) { #>
    424                 <a class="button button-primary customize load-customize hide-if-no-customize" href="{{{ data.actions.customize }}}"><?php _e( 'Customize' ); ?></a>
     413            <h2 class="theme-name" id="{{ data.id }}-name">
     414                <?php
     415                /* translators: %s: Theme name */
     416                printf( __( '<span>Active:</span> %s' ), '{{{ data.name }}}' );
     417                ?>
     418            </h2>
     419        <# } else { #>
     420            <h2 class="theme-name" id="{{ data.id }}-name">{{{ data.name }}}</h2>
     421        <# } #>
     422
     423        <div class="theme-actions">
     424            <# if ( data.active ) { #>
     425                <# if ( data.actions.customize ) { #>
     426                    <a class="button button-primary customize load-customize hide-if-no-customize" href="{{{ data.actions.customize }}}"><?php _e( 'Customize' ); ?></a>
     427                <# } #>
     428            <# } else { #>
     429                <?php
     430                /* translators: %s: Theme name */
     431                $aria_label = sprintf( _x( 'Activate %s', 'theme' ), '{{ data.name }}' );
     432                ?>
     433                <a class="button activate" href="{{{ data.actions.activate }}}" aria-label="<?php echo $aria_label; ?>"><?php _e( 'Activate' ); ?></a>
     434                <a class="button button-primary load-customize hide-if-no-customize" href="{{{ data.actions.customize }}}"><?php _e( 'Live Preview' ); ?></a>
    425435            <# } #>
    426         <# } else { #>
    427             <?php
    428             /* translators: %s: Theme name */
    429             $aria_label = sprintf( _x( 'Activate %s', 'theme' ), '{{ data.name }}' );
    430             ?>
    431             <a class="button activate" href="{{{ data.actions.activate }}}" aria-label="<?php echo $aria_label; ?>"><?php _e( 'Activate' ); ?></a>
    432             <a class="button button-primary load-customize hide-if-no-customize" href="{{{ data.actions.customize }}}"><?php _e( 'Live Preview' ); ?></a>
    433         <# } #>
     436        </div>
    434437    </div>
    435438</script>
Note: See TracChangeset for help on using the changeset viewer.