WordPress.org

Make WordPress Core


Ignore:
Timestamp:
05/06/2012 11:06:47 PM (10 years ago)
Author:
koopersmith
Message:

Add 'Install now', 'Preview', and 'Details' links to theme install list items. fixes #20403.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/class-wp-theme-install-list-table.php

    r20639 r20730  
    193193        ) );
    194194
     195        $actions = array();
     196
     197        $install_url = add_query_arg( array(
     198            'action' => 'install-theme',
     199            'theme'  => $theme->slug,
     200        ), self_admin_url( 'update.php' ) );
     201        $actions[] = '<a class="install-now" href="' . wp_nonce_url( $install_url, 'install-theme_' . $theme->slug ) . '" title="' . esc_attr( sprintf( __( 'Install %s' ), $name ) ) . '">' . __( 'Install Now' ) . '</a>';
     202
     203        $actions[] = '<a class="install-theme-preview" href="#" title="' . esc_attr( sprintf( __( 'Preview %s' ), $name ) ) . '">' . __( 'Preview' ) . '</a>';
     204
     205        $actions = apply_filters( 'theme_install_actions', $actions, $theme );
     206
    195207        ?>
    196         <a class="screenshot" href="<?php echo esc_url( $preview_url ); ?>" title="<?php echo esc_attr( $preview_title ); ?>">
     208        <a class="screenshot install-theme-preview" href="<?php echo esc_url( $preview_url ); ?>" title="<?php echo esc_attr( $preview_title ); ?>">
    197209            <img src='<?php echo esc_url( $theme->screenshot_url ); ?>' width='150' />
    198210        </a>
     
    200212        <h3><?php echo $name; ?></h3>
    201213        <div class="theme-author"><?php printf( __( 'By %s' ), $author ); ?></div>
     214
     215        <div class="action-links">
     216            <ul>
     217                <?php foreach ( $actions as $action ): ?>
     218                    <li><?php echo $action; ?></li>
     219                <?php endforeach; ?>
     220                <li class="hide-if-no-js"><a href="#" class="theme-detail" tabindex='4'><?php _e('Details') ?></a></li>
     221            </ul>
     222        </div>
    202223
    203224        <?php
     
    278299                <img class="theme-screenshot" src="<?php echo esc_url( $theme->screenshot_url ); ?>" />
    279300            <?php endif; ?>
    280             <div class="theme-rating" title="<?php echo esc_attr( $num_ratings ); ?>">
    281                 <div style="width:<?php echo esc_attr( intval( $theme->rating ) . 'px' ); ?>;"></div>
    282             </div>
    283             <div class="theme-version">
    284                 <strong><?php _e('Version:') ?> </strong>
    285                 <?php echo wp_kses( $theme->version, $themes_allowedtags ); ?>
    286             </div>
    287             <div class="theme-description">
    288                 <?php echo wp_kses( $theme->description, $themes_allowedtags ); ?>
     301            <div class="theme-details">
     302                <div class="theme-rating" title="<?php echo esc_attr( $num_ratings ); ?>">
     303                    <div style="width:<?php echo esc_attr( intval( $theme->rating ) . 'px' ); ?>;"></div>
     304                </div>
     305                <div class="theme-version">
     306                    <strong><?php _e('Version:') ?> </strong>
     307                    <?php echo wp_kses( $theme->version, $themes_allowedtags ); ?>
     308                </div>
     309                <div class="theme-description">
     310                    <?php echo wp_kses( $theme->description, $themes_allowedtags ); ?>
     311                </div>
    289312            </div>
    290313            <input class="theme-preview-url" type="hidden" value="<?php echo esc_url( $theme->preview_url ); ?>" />
Note: See TracChangeset for help on using the changeset viewer.