Making WordPress.org


Ignore:
Timestamp:
07/09/2014 06:52:50 PM (10 years ago)
Author:
coffee2code
Message:

Code Reference: add search summary info to top of search results page

props melchoyce.
see #450.

File:
1 edited

Legend:

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

    r742 r743  
    77?>
    88<div class="search-section section clear">
     9
     10<?php if ( is_search() ) { ?>
     11
     12    <div class="search-results-summary"><?php
     13    $count = (int) $GLOBALS['wp_query']->found_posts;
     14
     15    if ( $count ) {
     16        if ( is_paged() ) {
     17            $start = get_query_var( 'posts_per_page' ) * ( get_query_var( 'paged' ) - 1 );
     18        } else {
     19            $start = 0;
     20        }
     21        $end = min( $count, $start + get_query_var( 'posts_per_page' ) );
     22        printf(
     23            _n( '<strong>%d</strong> result found for "<strong>%s</strong>".', '<strong>%d</strong> results found for "<strong>%s</strong>". Showing results %d to %d.', $count, 'wporg' ),
     24            $count,
     25            esc_html( get_search_query() ),
     26            $start + 1,
     27            $end
     28        );
     29    } else {
     30        printf( __( '<strong>%d</strong> results found for "<strong>%s</strong>".', 'wporg' ), $count, esc_html( get_search_query() ) );
     31    }
     32    ?></div>
     33
     34<?php } ?>
    935
    1036    <form role="search" method="get" class="searchform" action="<?php echo esc_url( home_url( '/' ) ); ?>">
Note: See TracChangeset for help on using the changeset viewer.