Making WordPress.org


Ignore:
Timestamp:
03/17/2016 05:39:02 AM (11 years ago)
Author:
dd32
Message:

Themes Directory: Open-source the pre_get_posts logic used by the Themes Directory & add logic to handle the domain not matching the home_url.

This allows us to remove the 'placeholder' sites we use for the themes directory on internationalized sites (xx.wordpress.org/themes), and makes the query logic more transparent.

See #1630 (which this is the first part for)
See #1618 (Some work will still be needed to correctly trim the description)

File:
1 edited

Legend:

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

    r1813 r2755  
    1212 */
    1313
    14 global $themes;
    15 
    1614get_header();
    1715?>
    … …  
    1917                <div class="wp-filter">
    2018                        <div class="filter-count">
    21                                 <span class="count theme-count"><?php echo number_format_i18n( $themes['total'] ); ?></span>
     19                                <span class="count theme-count"><?php echo number_format_i18n( $wp_query->found_posts ); ?></span>
    2220                        </div>
    2321
    … …  
    6765                                <?php
    6866                                if ( get_query_var('name') && !is_404() ) {
    69                                         $theme = reset( $themes['themes'] );
    70                                         include __DIR__ . '/theme-single.php';
     67                                        while ( have_posts() ) {
     68                                                the_post();
     69                                                $theme = wporg_themes_theme_information( $post->post_name );
     70                                                include __DIR__ . '/theme-single.php';
     71                                        }
    7172                                } else {
    72                                         foreach ( $themes['themes'] as $theme ) {
     73                                        while ( have_posts() ) {
     74                                                the_post();
     75                                                $theme = wporg_themes_theme_information( $post->post_name );
    7376                                                include __DIR__ . '/theme.php';
    7477                                        }
    7578
    7679                                        // Add the navigation between pages
    77                                         if ( $themes['pages'] > 1 ) {
    78                                                 echo '<nav class="posts-navigation">';
    79                                                 echo paginate_links( array(
    80                                                         'total' => $themes['pages'],
    81                                                         'mid_size' => 3,
    82                                                 ) );
    83                                                 echo '</nav>';
    84                                         }
     80                                        echo '<nav class="posts-navigation">';
     81                                        echo paginate_links( array(
     82                                                'mid_size' => 3,
     83                                        ) );
     84                                        echo '</nav>';
    8585                                }
    8686                                ?>
    8787                        </div>
    8888
     89                        <?php /* TODO: Don't display this for no-js queries where $wp_query->post_count > 0, but JS needs it too. */ ?>
    8990                        <p class="no-themes"><?php _e( 'No themes found. Try a different search.', 'wporg-themes' ); ?></p>
    9091                </div>
Note: See TracChangeset for help on using the changeset viewer.