WordPress.org

Making WordPress.org

Ticket #2089: 2089.patch

File 2089.patch, 3.0 KB (added by keesiemeijer, 3 years ago)

Add searchform to 404 pages

  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/template-tags.php

     
    13221322                $post_types = get_parsed_post_types();
    13231323                $taxonomies = array( 'wp-parser-since', 'wp-parser-package', 'wp-parser-source-file' );
    13241324
    1325                 return ! is_search() && ( is_singular( $post_types ) || is_post_type_archive( $post_types ) || is_tax( $taxonomies ) || get_query_var( 'is_handbook' ) );
     1325                return ! ( is_search() || is_404() ) && ( is_singular( $post_types ) || is_post_type_archive( $post_types ) || is_tax( $taxonomies ) || get_query_var( 'is_handbook' ) );
    13261326        }
    13271327
    13281328        /**
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/js/autocomplete.js

     
    1111                return;
    1212        }
    1313
    14         var form = $( '.searchform' ).not(".searchform-handbook");
     14        var form = $( '.searchform-filtered');
    1515        if ( ! form.length ) {
    1616                return;
    1717        }
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/searchform.php

     
    55 * @package wporg-developer
    66 */
    77?>
    8 <div class="search-section section clear <?php if ( ! ( is_page( 'reference' ) || is_search() ) ) { echo 'hide-if-js'; } ?>">
     8<div class="search-section section clear <?php if ( ! ( is_page( 'reference' ) || is_search() || is_404() ) ) { echo 'hide-if-js'; } ?>">
    99
    1010<?php if ( is_search() ) { ?>
    1111
     
    3737                $is_handbook = get_query_var( 'is_handbook' );
    3838                $search_url  = get_query_var( 'current_handbook_home_url' );
    3939                $search_url  = $search_url ? $search_url : home_url( '/' );
    40                 $form_class  = $is_handbook ? ' searchform-handbook' : '';
     40                $filters     = ! ( $is_handbook || is_404() );
     41                $form_class  = ( $filters ) ? ' searchform-filtered' : '';
    4142        ?>
    4243
    4344        <form role="search" method="get" class="searchform<?php echo esc_attr( $form_class ); ?>" action="<?php echo esc_url( $search_url ); ?>">
     
    4950                <input type="submit" class="shiny-blue search-submit" value="<?php echo esc_attr_x( 'Search', 'submit button', 'wporg' ); ?>">
    5051                </div>
    5152
    52         <?php if ( ! $is_handbook ) : ?>
     53        <?php if ( $filters ) : ?>
    5354
    5455                <div class="search-post-type">
    5556                        <span><?php _e( 'Filter by type:', 'wporg' ); ?></span>