WordPress.org

Making WordPress.org

Changeset 2781


Ignore:
Timestamp:
03/22/2016 08:03:43 PM (3 years ago)
Author:
coffee2code
Message:

developer.wordpress.org: Order search results by title relevance.

Props keesiemeijer.
Fixes #1516.

File:
1 edited

Legend:

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

    r2768 r2781  
    201201    }
    202202
    203     // If user has '()' at end of a search string, assume they want a specific function/method.
    204203    if ( $query->is_search() ) {
     204
     205        // Order searches by title first.
     206        $query->set( 'orderby', '' );
     207        $query->set( 'search_orderby_title', 1 );
     208
     209        // If user has '()' at end of a search string, assume they want a specific function/method.
    205210        $s = htmlentities( $query->get( 's' ) );
    206211        if ( '()' === substr( $s, -2 ) ) {
Note: See TracChangeset for help on using the changeset viewer.