Changeset 13349
- Timestamp:
- 03/15/2024 07:16:32 AM (2 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content
- Files:
-
- 2 edited
-
plugins/plugin-directory/class-plugin-directory.php (modified) (5 diffs)
-
themes/pub/wporg-plugins-2024/inc/block-config.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-directory.php
r13332 r13349 1022 1022 break; 1023 1023 1024 case 'ratings': 1025 $wp_query->query_vars['orderby'] = 'num_ratings'; 1026 // Fall through. 1024 1027 case 'num_ratings': 1025 case 'ratings':1026 1028 $wp_query->query_vars['meta_query']['num_ratings'] ??= [ 1027 1029 'key' => 'num_ratings', … … 1030 1032 'value' => 0, 1031 1033 ]; 1032 1033 $wp_query->query_vars['orderby'] = 'num_ratings';1034 1034 break; 1035 1035 1036 1036 case '_active_installs': 1037 $wp_query->query_vars['orderby'] = 'active_installs'; 1038 // Fall through. 1037 1039 case 'active_installs': 1038 1040 $wp_query->query_vars['meta_query']['active_installs'] ??= [ … … 1041 1043 'compare' => 'EXISTS' 1042 1044 ]; 1043 1044 $wp_query->query_vars['orderby'] = 'active_installs';1045 1045 break; 1046 1046 … … 1067 1067 'compare' => 'EXISTS', 1068 1068 ]; 1069 $wp_query->query_vars['orderby'] = 'downloads';1070 1069 break; 1071 1070 } … … 1468 1467 // New-style search links. 1469 1468 if ( get_query_var( 's' ) && isset( $_GET['s'] ) ) { 1470 $url = site_url( '/search/' . urlencode( get_query_var( 's' ) ) . '/' ); 1471 if ( get_query_var( 'block_search' ) ) { 1472 $url = add_query_arg( 'block_search', get_query_var( 'block_search' ), $url ); 1469 $url = site_url( '/search/' . urlencode( get_query_var( 's' ) ) . '/' ); 1470 $query_vars = array_filter( $wp_query->query ); 1471 1472 // Don't need the search.. 1473 unset( $query_vars['s'] ); 1474 1475 // Temporary: Disable sorts for search. 1476 unset( $query_vars['order'], $query_vars['orderby'] ); 1477 1478 if ( ! empty( $query_vars ) ) { 1479 $url = add_query_arg( $query_vars, $url ); 1473 1480 } 1474 1481 -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins-2024/inc/block-config.php
r13345 r13349 130 130 $values = (array) $values; 131 131 foreach ( $values as $value ) { 132 // Support for tax archives... TODO Hacky.. 133 // Realistically we should just ditch these and have all of the filters hit /search/?stuff=goes&here 134 if ( is_tax() && $value === ( get_queried_object()->slug ?? '' ) ) { 132 if ( is_search() && 's' === $query_var ) { 135 133 continue; 136 } elseif ( is_search() && 's' === $query_var ) { 134 } elseif ( 'plugin_tags' === $query_var ) { 135 // We don't support tags yet as a filter. 137 136 continue; 137 } elseif ( 'browse' === $query_var ) { 138 // Don't retain if there's no actual items in the section (ie. it's dynamic). 139 $term = get_term_by( 'slug', $value, 'plugin_section' ); 140 if ( ! $term || ! $term->count ) { 141 continue; 142 } 138 143 } 139 144 … … 146 151 } 147 152 153 // If this is a block directory search, that needs to be retained too. 154 if ( is_search() && get_query_var( 'block_search' ) ) { 155 echo '<input type="hidden" name="block_search" value="1" />'; 156 } 157 148 158 } 149 159 … … 153 163 154 164 /** 155 * Filters the search block to remove required attribute.165 * Filters the search block to remove the required attribute, and add the query fields. 156 166 * 157 167 * @param string $block_content … … 164 174 } 165 175 166 return preg_replace( '/(<input[^>]*)\s+required\s*([^>]*)>/', '$1$2>', $block_content ); 176 // Remove the required attribute 177 $block_content = preg_replace( '/(<input[^>]*)\s+required\s*([^>]*)>/', '$1$2>', $block_content ); 178 179 // Insert the current query filters into the search form. 180 ob_start(); 181 wporg_query_filter_in_form( 's' ); 182 $block_content = str_replace( '</form>', ob_get_clean() . '</form>', $block_content ); 183 184 return $block_content; 167 185 }
Note: See TracChangeset
for help on using the changeset viewer.