WordPress.org

Make WordPress Core

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

File 31530-01-add-theme-id.diff, 1.3 KB (added by stephdau, 6 years ago)

Adds an id attribute to the div used to display themes in appearance.

  • 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                });