Changeset 3343
- Timestamp:
- 06/13/2016 06:18:01 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-directory.php
r3342 r3343 427 427 $wp_query->query_vars['p'] = -1; 428 428 } 429 430 add_filter( 'posts_where', array( $this, 'pre_get_posts_sql_browse' ) ); 429 431 break; 430 432 431 433 case 'popular': 432 add_filter( 'posts_where', array( $this, 'pre_get_posts_sql_browse _popular' ) );434 add_filter( 'posts_where', array( $this, 'pre_get_posts_sql_browse' ) ); 433 435 break; 434 436 } … … 441 443 442 444 /** 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 * Callback to remove the requirement for plugins to be tagged with the requested 446 * plugin_section term. 447 * 448 * Used for archives like `popular` or `favorites`, that all active plugins are a part of. 445 449 * 446 450 * @ignore … … 449 453 * @return string 450 454 */ 451 public function pre_get_posts_sql_browse _popular( $where ) {455 public function pre_get_posts_sql_browse( $where ) { 452 456 global $wpdb; 453 457 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 ); 458 remove_filter( 'posts_where', array( $this, 'pre_get_posts_sql_browse' ) ); 459 460 $term = get_term_by( 'slug', get_query_var( 'browse' ), 'plugin_section' ); 461 462 if ( $term instanceof \WP_Term ) { 463 $where = str_replace( " AND ( \n {$wpdb->term_relationships}.term_taxonomy_id IN ({$term->term_id})\n)", '', $where ); 464 } 465 466 return $where; 458 467 } 459 468
Note: See TracChangeset
for help on using the changeset viewer.