Making WordPress.org

Changeset 744


Ignore:
Timestamp:
07/09/2014 06:54:57 PM (12 years ago)
Author:
coffee2code
Message:

Code Reference: add post_type search filter checkboxes to search form (all checked by default). Fixes #552

Location:
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/scss/main.scss

    r743 r744  
    610610                div {
    611611                        overflow: auto;
     612                }
     613                .search-post-type {
     614                        label {
     615                                border-right: 1px solid #ccc;
     616                                float: none;
     617                                width: inherit;
     618                                margin-left: 1em;
     619                                margin-right: 0;
     620                                padding-left: 0;
     621                                padding-right: 1.3em;
     622                                input {
     623                                        padding-left: 0.5em;
     624                                }
     625                        }
     626                        label:last-child {
     627                                border-right-width: 0;
     628                        }
    612629                }
    613630        }
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/searchform.php

    r743 r744  
    4242                <input type="submit" class="shiny-blue search-submit" value="<?php echo esc_attr_x( 'Search', 'submit button', 'wporg' ); ?>">
    4343                </div>
     44
     45                <div class="search-post-type">
     46                        <span><?php _e( 'Filter by type:', 'wporg' ); ?></span>
     47                        <?php
     48                                $search_post_types = array(
     49                                        'wp-parser-function' => __( 'Functions', 'wporg' ),
     50                                        'wp-parser-hook'     => __( 'Hooks',     'wporg' ),
     51                                        'wp-parser-class'    => __( 'Classes',   'wporg' ),
     52                                        'wp-parser-method'   => __( 'Methods',   'wporg' ),
     53                                );
     54                                foreach ( $search_post_types as $post_type => $label ) {
     55                                        $qv_post_type = (array) get_query_var( 'post_type' );
     56                                ?>
     57                                        <label><input type="checkbox" name="post_type[]" value="<?php echo esc_attr( $post_type ); ?>"
     58                                        <?php checked( ! is_search() || in_array( 'any', $qv_post_type ) || in_array( $post_type, $qv_post_type ) ); ?> /> <?php echo $label; ?></label>
     59                                <?php } ?>
     60                </div>
    4461        </form>
    4562
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/stylesheets/main.css

    r743 r744  
    855855  overflow: auto;
    856856}
     857.devhub-wrap .searchform .search-post-type label {
     858  border-right: 1px solid #ccc;
     859  float: none;
     860  width: inherit;
     861  margin-left: 1em;
     862  margin-right: 0;
     863  padding-left: 0;
     864  padding-right: 1.3em;
     865}
     866.devhub-wrap .searchform .search-post-type label input {
     867  padding-left: 0.5em;
     868}
     869.devhub-wrap .searchform .search-post-type label:last-child {
     870  border-right-width: 0;
     871}
    857872.devhub-wrap .search-results-summary {
    858873  font-style: italic;
Note: See TracChangeset for help on using the changeset viewer.