Making WordPress.org

Changeset 3342


Ignore:
Timestamp:
06/13/2016 05:46:40 PM (8 years ago)
Author:
obenland
Message:

Plugin Directory: Order archives by install count.

See #1573.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-directory.php

    r3338 r3342  
    253253     * Setting up the site requires setting up the theme and proper
    254254     * rewrite permastructs.
     255     *
     256     * @global \WP_Rewrite $wp_rewrite WordPress rewrite component.
    255257     */
    256258    public function activate() {
    257 
    258         /**
    259          * @var \WP_Rewrite $wp_rewrite WordPress rewrite component.
    260          */
    261259        global $wp_rewrite;
    262260
     
    432430
    433431            case 'popular':
    434                 $wp_query->query_vars['orderby'] = 'meta_value_num';
    435                 $wp_query->query_vars['meta_key'] = 'active_installs';
    436 
    437432                add_filter( 'posts_where', array( $this, 'pre_get_posts_sql_browse_popular' ) );
    438433                break;
     434        }
     435
     436        if ( $wp_query->is_archive() && empty( $wp_query->query_vars['orderby'] ) ) {
     437            $wp_query->query_vars['orderby']  = 'meta_value_num';
     438            $wp_query->query_vars['meta_key'] = 'active_installs';
    439439        }
    440440    }
Note: See TracChangeset for help on using the changeset viewer.