Ticket #21826: 21826.2.patch

File 21826.2.patch, 2.6 KB (added by ethitter, 8 months ago)

Converts to a single filter and an array

  • wp-admin/includes/class-wp-themes-list-table.php

     
    151151                        $delete_action = isset( $actions['delete'] ) ? '<div class="delete-theme">' . $actions['delete'] . '</div>' : ''; 
    152152                        unset( $actions['delete'] ); 
    153153 
     154                        // Make theme display info available for filtering 
     155                        $theme_info = array( 
     156                                'screenshot' => $theme->get_screenshot(), 
     157                                'title' => $title, 
     158                                'author' => $author, 
     159                                'version' => $version, 
     160                                'description' => $theme->display( 'Description' ) 
     161                        ); 
     162                        $theme_info = apply_filters( 'theme_display_info', $theme_info, $theme ); 
     163 
    154164                        ?> 
    155165 
    156                         <a href="<?php echo $preview_link; ?>" class="screenshot hide-if-customize"> 
    157                                 <?php if ( $screenshot = $theme->get_screenshot() ) : ?> 
    158                                         <img src="<?php echo esc_url( $screenshot ); ?>" alt="" /> 
    159                                 <?php endif; ?> 
    160                         </a> 
    161                         <a href="<?php echo wp_customize_url( $stylesheet ); ?>" class="screenshot load-customize hide-if-no-customize"> 
    162                                 <?php if ( $screenshot = $theme->get_screenshot() ) : ?> 
    163                                         <img src="<?php echo esc_url( $screenshot ); ?>" alt="" /> 
    164                                 <?php endif; ?> 
    165                         </a> 
     166                        <?php if ( ! empty( $theme_info['screenshot'] ) ) : ?> 
     167                                <a href="<?php echo $preview_link; ?>" class="screenshot hide-if-customize"> 
     168                                        <img src="<?php echo esc_url( $theme_info['screenshot'] ); ?>" alt="" /> 
     169                                </a> 
    166170 
    167                         <h3><?php echo $title; ?></h3> 
    168                         <div class="theme-author"><?php printf( __( 'By %s' ), $author ); ?></div> 
     171                                <a href="<?php echo wp_customize_url( $stylesheet ); ?>" class="screenshot load-customize hide-if-no-customize"> 
     172                                        <img src="<?php echo esc_url( $theme_info['screenshot'] ); ?>" alt="" /> 
     173                                </a> 
     174                        <?php endif; ?> 
     175 
     176                        <h3><?php echo $theme_info['title' ]; ?></h3> 
     177 
     178                        <?php if ( ! empty( $theme_info['author'] ) ) : ?> 
     179                                <div class="theme-author"><?php printf( __( 'By %s' ), $theme_info['author'] ); ?></div> 
     180                        <?php endif; ?> 
     181 
    169182                        <div class="action-links"> 
    170183                                <ul> 
    171184                                        <?php foreach ( $actions as $action ): ?> 
     
    179192                        </div> 
    180193 
    181194                        <div class="themedetaildiv hide-if-js"> 
    182                                 <p><strong><?php _e('Version: '); ?></strong><?php echo $version; ?></p> 
    183                                 <p><?php echo $theme->display('Description'); ?></p> 
     195                                <?php if ( ! empty( $theme_info['version'] ) ) : ?> 
     196                                        <p><strong><?php _e( 'Version: ' ); ?></strong><?php echo esc_html( $theme_info['version'] ); ?></p> 
     197                                <?php endif; ?> 
     198 
     199                                <p><?php echo $theme_info['description']; ?></p> 
    184200                        </div> 
    185201 
    186202                        </div>