Making WordPress.org


Ignore:
Timestamp:
11/25/2014 08:49:42 PM (10 years ago)
Author:
obenland
Message:

WP.org Themes: Make theme previews work.

  • Consolidates data handling for index and single.
  • Makes Previews play nicely with Modals.
  • Streamlines some UI aspects between Previews and Modals.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-themes/index.php

    r1001 r1006  
    1212 */
    1313
     14$template_part = is_single() ? 'single' : 'index';
    1415include ABSPATH . 'wp-admin/includes/theme.php';
    15 $themes = themes_api( 'query_themes', array(
    16     'per_page' => 15,
    17     'browse'   => get_query_var( 'attachment' ) ? get_query_var( 'attachment' )  : 'search',
    18 ) );
     16if ( is_single() ) {
     17    $themes = themes_api( 'theme_information', array( 'slug' => get_post()->post_name ) );
     18} else {
     19    $themes = themes_api( 'query_themes', array(
     20        'per_page' => 15,
     21        'browse'   => get_query_var( 'attachment' ) ? get_query_var( 'attachment' ) : 'featured',
     22        'fields'   => 'tags',
     23    ) );
     24}
    1925
    2026get_header();
     
    4248                <a class="clear-filters button button-secondary" href="#"><?php _e( 'Clear' ); ?></a>
    4349            </div>
     50
    4451            <?php foreach ( get_theme_feature_list() as $feature_name => $features ) : ?>
    4552            <div class="filter-group">
     
    5562            </div>
    5663            <?php endforeach; ?>
     64
    5765            <div class="filtered-by">
    5866                <span><?php _e( 'Filtering by:' ); ?></span>
     
    6169            </div>
    6270        </div>
     71    </div><!-- .wp-filter -->
     72
     73    <div class="theme-browser content-filterable">
     74        <div class="themes">
     75            <?php
     76                if ( ! is_wp_error( $themes ) ) :
     77                    foreach ( $themes->themes as $theme ) :
     78                        get_template_part( 'content', $template_part );
     79                    endforeach;
     80                endif;
     81            ?>
     82        </div>
    6383    </div>
    64     <div class="theme-browser content-filterable">
    65         <?php
    66             if ( ! is_wp_error( $themes ) ) :
    67                 foreach ( $themes->themes as $theme ) :
    68                     get_template_part( 'content', 'index' );
    69                 endforeach;
    70             endif;
    71         ?>
    72     </div>
     84    <div class="theme-install-overlay"></div>
    7385    <div class="theme-overlay"></div>
    7486
Note: See TracChangeset for help on using the changeset viewer.