WordPress.org

Making WordPress.org

Changeset 3208


Ignore:
Timestamp:
05/20/2016 10:50:42 PM (6 years ago)
Author:
obenland
Message:

Plugin Directory: Populate the three featured plugin groups.

See #1719.

File:
1 edited

Legend:

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

    r3204 r3208  
    1111
    1212$sections = array(
    13     'popular ' => __( 'Popular Plugins', 'wporg-plugins' ),
    14     'trending' => __( 'Trending Plugins', 'wporg-plugins' ),
     13    'featured' => __( 'Featured Plugins', 'wporg-plugins' ),
     14    'popular'  => __( 'Popular Plugins', 'wporg-plugins' ),
    1515    'beta'     => __( 'Beta Plugins', 'wporg-plugins' ),
    1616);
     
    2626    <main id="main" class="site-main" role="main">
    2727
    28         <?php foreach ( $sections as $section_slug => $section_title ) : ?>
     28        <?php foreach ( $sections as $section_slug => $section_title ) :
     29            $section_args = array(
     30                'post_type'       => 'plugin',
     31                'posts_per_page'  => 4,
     32                'plugin_category' => $section_slug,
     33            );
     34
     35            if ( 'popular' === $section_slug ) :
     36                $section_args['meta_key'] = 'active_installs';
     37                $section_args['orderby']  = 'meta_value_num';
     38                unset( $section_args['plugin_category'] );
     39            endif;
     40
     41            $section_query = new \WP_Query( $section_args );
     42        ?>
    2943
    3044            <section class="plugin-section">
    3145                <header class="section-header">
    3246                    <h1 class="section-title"><?php echo esc_html( $section_title ); ?></h1>
    33                     <a class="section-link" href="<?php echo esc_url( home_url( $section_slug ) ); ?>"><?php _ex( 'See all', 'plugins', 'wporg-plugins' ); ?></a>
     47                    <a class="section-link" href="<?php echo esc_url( home_url( "browse/$section_slug/" ) ); ?>"><?php _ex( 'See all', 'plugins', 'wporg-plugins' ); ?></a>
    3448                </header>
    3549
    3650                <?php
    37                     while ( have_posts() ) :
    38                         the_post();
     51                    while ( $section_query->have_posts() ) :
     52                        $section_query->the_post();
    3953
    4054                        get_template_part( 'template-parts/plugin', 'index' );
Note: See TracChangeset for help on using the changeset viewer.