Changeset 3338 for sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-directory.php
- Timestamp:
- 06/12/2016 10:15:16 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-directory.php
r3335 r3338 99 99 register_taxonomy( 'plugin_section', 'plugin', array( 100 100 'hierarchical' => true, 101 'query_var' => ' plugin_section',101 'query_var' => 'browse', 102 102 'rewrite' => false, 103 103 'public' => true, … … 109 109 ), 110 110 'labels' => array( 111 'name' => __( ' Plugin Sections', 'wporg-plugins' ),111 'name' => __( 'Browse', 'wporg-plugins' ), 112 112 ), 113 113 ) ); … … 409 409 410 410 switch ( get_query_var( 'browse' ) ) { 411 case 'beta':412 $wp_query->query_vars['plugin_section'] = 'beta';413 break;414 415 case 'featured':416 $wp_query->query_vars['plugin_section'] = 'featured';417 break;418 419 411 case 'favorites': 420 412 $favorites_user = get_current_user_id(); … … 442 434 $wp_query->query_vars['orderby'] = 'meta_value_num'; 443 435 $wp_query->query_vars['meta_key'] = 'active_installs'; 436 437 add_filter( 'posts_where', array( $this, 'pre_get_posts_sql_browse_popular' ) ); 444 438 break; 445 439 } 446 440 } 441 442 /** 443 * Custom callback for pre_get_posts to remove the requirement for plugins to be tagged 444 * 'popular' to show up when browsing popular plugins. 445 * 446 * @ignore 447 * 448 * @param string $where WHERE clause. 449 * @return string 450 */ 451 public function pre_get_posts_sql_browse_popular( $where ) { 452 global $wpdb; 453 454 remove_filter( 'posts_where', array( $this, 'pre_get_posts_sql_browse_popular' ) ); 455 $term = get_term_by( 'slug', 'popular', 'plugin_section' ); 456 457 return str_replace( " AND ( \n {$wpdb->term_relationships}.term_taxonomy_id IN ({$term->term_id})\n)", '', $where ); 447 458 } 448 459 … … 613 624 /** 614 625 * Filters the value of tax_inputs before saving. 615 * 626 * 616 627 * Used both in the admin and the uploader. 617 628 *
Note: See TracChangeset
for help on using the changeset viewer.