WordPress.org

Making WordPress.org


Ignore:
Timestamp:
02/25/2015 11:26:57 PM (7 years ago)
Author:
obenland
Message:

WP.org Themes: Make commercial theme shops the content type that they are.

See #745.

File:
1 edited

Legend:

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

    r1237 r1331  
    66 */
    77
    8 
    9 /**
    10  * Filter to get an array of data for theme shops to be listed.
    11  *
    12  * Expected structure for each element in the commercial theme shops array:
    13  *
    14  * array(
    15  *    'name'        => '', // Theme shop name.
    16  *    'url'         => '', // Company URL.
    17  *    'description' => "", // Haiku.
    18  *    'user_id'     => '', // User ID of the WordPress.org user associated with the theme shop.
    19  *    'image'       => '', // Theme shop site screenshot URL. Optional; only if overriding default, automatic image retrieval.
    20  * )
    21  *
    22  * @param array $commercial Array of commercial theme shops data array. Default empty array.
    23  */
    24 $commercial = (array) apply_filters( 'wporg_themes_commercial', array() );
    25 
    26 shuffle( $commercial );
     8$theme_shops = new WP_Query( array(
     9    'post_type'      => 'theme_shop',
     10    'posts_per_page' => -1,
     11    'orderby'        => 'rand',
     12) );
    2713
    2814get_header();
     
    5238                    <div class="theme-browser content-filterable">
    5339                        <div class="themes">
    54                             <?php foreach ( $commercial as $theme ) : ?>
    55                                 <article id="post-<?php echo sanitize_title_with_dashes( $theme['name'] ); ?>" class="theme hentry">
    56                                     <div class="theme-screenshot">
    57                                         <img src="<?php echo esc_url( '//s0.wp.com/mshots/v1/' . urlencode( $theme['url'] ) . '?w=572' ); ?>" alt="">
    58                                     </div>
    59                                     <a class="more-details url" href="<?php echo esc_url( $theme['url'] ); ?>" rel="bookmark"><?php echo nl2br( $theme['description'] ); ?></a>
    60                                     <h3 class="theme-name entry-title"><?php echo $theme['name']; ?></h3>
    61                                 </article>
    62                             <?php endforeach; ?>
     40                            <?php
     41                                while ( $theme_shops->have_posts() ) :
     42                                    $theme_shops->the_post();
     43                            ?>
     44                            <article id="post-<?php the_ID(); ?>" <?php post_class( array( 'theme', 'hentry' ) ); ?>>
     45                                <div class="theme-screenshot">
     46                                    <img src="<?php echo esc_url( '//s0.wp.com/mshots/v1/' . urlencode( post_custom( 'url' ) ) . '?w=572' ); ?>" alt="">
     47                                </div>
     48                                <a class="more-details url" href="<?php echo esc_url( post_custom( 'url' ) ); ?>" rel="bookmark"><?php the_content(); ?></a>
     49                                <h3 class="theme-name entry-title"><?php the_title(); ?></h3>
     50                            </article>
     51                            <?php
     52                                endwhile;
     53                                wp_reset_postdata();
     54                            ?>
    6355                        </div>
    6456                    </div>
Note: See TracChangeset for help on using the changeset viewer.