Ticket #601: 601.patch
File 601.patch, 6.8 KB (added by , 9 years ago) |
---|
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/archive.php
16 16 17 17 <main id="main" class="site-main" role="main"> 18 18 19 <?php taxonomy_archive_filter(); ?> 20 19 21 <?php if ( have_posts() ) : ?> 20 22 21 23 -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/extras.php
140 140 } 141 141 add_filter( 'the_title', 'wporg_filter_archive_title', 10, 2 ); 142 142 add_filter( 'single_post_title', 'wporg_filter_archive_title', 10, 2 ); 143 144 /** 145 * Removes the query string from get_pagenum_link() for loop pagination. 146 * Fixes pagination links like example.com/?foo=bar/page/2/. 147 * 148 * @param array $args Arguments for the paginate_links() function. 149 * @return array Arguments for the paginate_links() function. 150 */ 151 function wporg_loop_pagination_args( $args ) { 152 global $wp_rewrite; 153 154 /* Add the $base argument to the array if the user is using permalinks. */ 155 if ( $wp_rewrite->using_permalinks() && !is_search() ) { 156 $pagenum = trailingslashit( preg_replace( '/\?.*/', '', get_pagenum_link() ) ); 157 $pagination_base = $wp_rewrite->pagination_base; 158 159 $args['base'] = user_trailingslashit( $pagenum . "{$pagination_base}/%#%" ); 160 } 161 162 return $args; 163 } 164 add_filter( 'loop_pagination_args', 'wporg_loop_pagination_args' ); 165 166 /** 167 * Removes 'page/1' from pagination links with a query string. 168 * 169 * @param string $page_links Page links HTML. 170 * @return string Page links HTML. 171 */ 172 function wporg_loop_pagination( $page_links ) { 173 global $wp_rewrite; 174 175 $pagination_base = $wp_rewrite->pagination_base; 176 $request = remove_query_arg( 'paged' ); 177 $query_string = explode( '?', $request ); 178 179 if ( isset( $query_string[1] ) ) { 180 181 $query_string = preg_quote( $query_string[1], '#' ); 182 183 /* Remove 'page/1' from the entire output since it's not needed. */ 184 $page_links = preg_replace( 185 array( 186 "#(href=['\"].*?){$pagination_base}/1(\?{$query_string}['\"])#", // 'page/1' 187 "#(href=['\"].*?){$pagination_base}/1/(\?{$query_string}['\"])#", // 'page/1/' 188 ), 189 '$1$2', 190 $page_links 191 ); 192 } 193 194 return $page_links; 195 } 196 add_filter( 'loop_pagination', 'wporg_loop_pagination' ); -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/template-tags.php
340 340 /** 341 341 * Get an array of all parsed post types. 342 342 * 343 * @param string $labels If set to 'labels' post types with their labels are returned. 343 344 * @return array 344 345 */ 345 function get_parsed_post_types( ) {346 returnarray(347 'wp-parser-class' ,348 'wp-parser-function' ,349 'wp-parser-hook' ,350 'wp-parser-method' ,346 function get_parsed_post_types( $labels = '' ) { 347 $post_types = array( 348 'wp-parser-class' => __( 'Classes', 'wporg' ), 349 'wp-parser-function' => __( 'Functions', 'wporg' ), 350 'wp-parser-hook' => __( 'Hooks', 'wporg' ), 351 'wp-parser-method' => __( 'Methods', 'wporg' ), 351 352 ); 353 354 if ( 'labels' !== $labels ) { 355 return array_keys( $post_types ); 356 } 357 358 return $post_types; 352 359 } 353 360 354 361 /** … … 1371 1378 1372 1379 return $message; 1373 1380 } 1381 1382 /** 1383 * Displays a post type filter dropdown on taxonomy pages. 1384 * 1385 * @return string HTML filter form. 1386 */ 1387 function taxonomy_archive_filter() { 1388 global $wp_rewrite; 1389 1390 $taxonomies = array( 'wp-parser-since', 'wp-parser-package', 'wp-parser-source-file' ); 1391 $taxonomy = get_query_var( 'taxonomy' ); 1392 $term = get_query_var( 'term' ); 1393 1394 if ( !( is_tax() && in_array( $taxonomy, $taxonomies ) ) ) { 1395 return; 1396 } 1397 1398 $post_types = get_parsed_post_types( 'labels' ); 1399 $post_types = array( 'any' => __( 'Any type', 'wporg' ) ) + $post_types; 1400 1401 $qv_post_type = array_filter( (array) get_query_var( 'post_type' ) ); 1402 $qv_post_type = !empty( $qv_post_type ) ? $qv_post_type : array( 'any' ); 1403 1404 $options = ''; 1405 foreach ( $post_types as $post_type => $label ) { 1406 $selected = in_array( $post_type, $qv_post_type ) ? " selected='selected'" : ''; 1407 $options .= "\n\t<option$selected value='" . esc_attr( $post_type ) . "'>$label</option>"; 1408 } 1409 1410 $form = "<form method='get' class='archive-filter-form' action=''>"; 1411 1412 if ( !$wp_rewrite->using_permalinks() ) { 1413 // Add taxonomy and term when not using permalinks 1414 $form .= "<input type='hidden' name='$taxonomy' value='$term'>"; 1415 } 1416 1417 $form .= "<label for='archive-filter'>"; 1418 $form .= __( 'Filter by type:', 'wporg' ) . ' '; 1419 $form .= '<select name="post_type[]" id="archive-filter">'; 1420 $form .= $options . '</select></label>'; 1421 $form .= "<input class='shiny-blue' type='submit' value='Filter' /></form>"; 1422 1423 echo $form; 1424 } 1374 1425 } -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/scss/main.scss
673 673 } 674 674 } 675 675 676 .archive-filter-form { 677 margin: 5rem 0; 678 font-size: 1.5rem; 679 input[type="submit"] { 680 margin-left: .5em; 681 padding: 0.2em 0.5em; 682 line-height: 1.1; 683 font-size: 1.5rem; 684 } 685 } 686 676 687 .searchform { 677 688 overflow: hidden; 678 689 height: auto; -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/stylesheets/main.css
912 912 font-size: 36px; 913 913 line-height: 36px; 914 914 } 915 .devhub-wrap .archive-filter-form { 916 margin: 5rem 0; 917 font-size: 1.5rem; 918 } 919 .devhub-wrap .archive-filter-form input[type="submit"] { 920 margin-left: .5em; 921 padding: 0.2em 0.5em; 922 line-height: 1.1; 923 font-size: 1.5rem; 924 } 915 925 .devhub-wrap .searchform { 916 926 overflow: hidden; 917 927 height: auto;