Make WordPress Core

Ticket #31530: 31530-01-add-theme-id.2.diff

File 31530-01-add-theme-id.2.diff, 2.0 KB (added by stephdau, 8 years ago)

Same as 31530-01-add-theme-id.diff but also adds the standard theme-install class on the Install button for themes, as is done .further down in tmpl-theme-preview and in trunk/src/wp-admin/includes/class-wp-theme-install-list-table.php. Helps with JS targeting of install button.

  • src/wp-admin/themes.php

     
    210210        $aria_action = esc_attr( $theme['id'] . '-action' );
    211211        $aria_name   = esc_attr( $theme['id'] . '-name' );
    212212        ?>
    213 <div class="theme<?php if ( $theme['active'] ) echo ' active'; ?>" tabindex="0" aria-describedby="<?php echo $aria_action . ' ' . $aria_name; ?>">
     213<div id="theme-<?php echo esc_attr( $theme['id'] ); ?>" class="theme<?php if ( $theme['active'] ) echo ' active'; ?>" tabindex="0" aria-describedby="<?php echo $aria_action . ' ' . $aria_name; ?>">
    214214        <?php if ( ! empty( $theme['screenshot'][0] ) ) { ?>
    215215                <div class="theme-screenshot">
    216216                        <img src="<?php echo $theme['screenshot'][0]; ?>" alt="" />
  • src/wp-admin/js/theme.js

     
    384384        render: function() {
    385385                var data = this.model.toJSON();
    386386                // Render themes using the html template
    387                 this.$el.html( this.html( data ) ).attr({
     387                this.$el.attr(
     388                        'id', 'theme-' + data.id
     389                ).html( this.html( data ) ).attr({
    388390                        tabindex: 0,
    389391                        'aria-describedby' : data.id + '-action ' + data.id + '-name'
    390392                });
  • src/wp-admin/theme-install.php

     
    204204        <h3 class="theme-name">{{ data.name }}</h3>
    205205
    206206        <div class="theme-actions">
    207                 <a class="button button-primary" href="{{ data.install_url }}"><?php esc_html_e( 'Install' ); ?></a>
     207                <a class="button button-primary theme-install" href="{{ data.install_url }}"><?php esc_html_e( 'Install' ); ?></a>
    208208                <a class="button button-secondary preview install-theme-preview" href="#"><?php esc_html_e( 'Preview' ); ?></a>
    209209        </div>
    210210