Making WordPress.org


Ignore:
Timestamp:
04/15/2015 09:58:29 AM (12 years ago)
Author:
dd32
Message:

Theme Directory: Add a function to query against api.wordpress.org/themes/info without making a HTTP call, use it to pull in the Comercial Themes and for getting the Theme information for the no-js single view fallback.

File:
1 edited

Legend:

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

    r1477 r1479  
    66 */
    77
    8 $theme_shops = new WP_Query( array(
    9         'post_type'      => 'theme_shop',
    10         'posts_per_page' => -1,
    11         'orderby'        => 'rand',
    12 ) );
     8$theme_shops = wporg_themes_query_api( 'get_commercial_shops' )->shops;
    139
    1410get_header();
    … …  
    3834                                        <div class="theme-browser content-filterable">
    3935                                                <div class="themes">
    40                                                         <?php
    41                                                                 while ( $theme_shops->have_posts() ) :
    42                                                                         $theme_shops->the_post();
    43 
    44                                                                         if ( ! $image_url = post_custom( 'image_url' ) ) :
    45                                                                                 $image_url = sprintf( '//s0.wp.com/mshots/v1/%s?w=572', urlencode( post_custom( 'url' ) ) );
    46                                                                         endif;
    47                                                         ?>
    48                                                         <article id="post-<?php the_ID(); ?>" <?php post_class( array( 'theme', 'hentry' ) ); ?>>
     36                                                        <?php foreach ( $theme_shops as $shop ) : ?>
     37                                                        <article id="post-<?php echo esc_attr( $shop->slug ); ?>" class="theme hentry">
    4938                                                                <div class="theme-screenshot">
    50                                                                         <img src="<?php echo esc_url( $image_url ); ?>" alt="">
     39                                                                        <img src="<?php echo esc_url( $shop->image ); ?>" alt="">
    5140                                                                </div>
    52                                                                 <a class="more-details url" href="<?php echo esc_url( post_custom( 'url' ) ); ?>" rel="bookmark"><?php the_content(); ?></a>
    53                                                                 <h3 class="theme-name entry-title"><?php the_title(); ?></h3>
     41                                                                <a class="more-details url" href="<?php echo esc_url( $shop->url ); ?>" rel="bookmark"><?php echo apply_filters( 'the_content', $shop->haiku ); ?></a>
     42                                                                <h3 class="theme-name entry-title"><?php echo apply_filters( 'the_title', $shop->shop ); ?></h3>
    5443                                                        </article>
    55                                                         <?php
    56                                                                 endwhile;
    57                                                                 wp_reset_postdata();
    58                                                         ?>
     44                                                        <?php endforeach; ?>
    5945                                                </div>
    6046                                        </div>
Note: See TracChangeset for help on using the changeset viewer.