Making WordPress.org

Changeset 8579


Ignore:
Timestamp:
04/03/2019 07:57:35 PM (5 years ago)
Author:
coffee2code
Message:

Plugin Directory: Include total number of pages in page title for paginated views.

See #4328.

File:
1 edited

Legend:

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

    r8549 r8579  
    239239 */
    240240function document_title( $title ) {
     241    global $wp_query;
     242
    241243    if ( is_front_page() ) {
    242244        $title['title']   = __( 'WordPress Plugins', 'wporg-plugins' );
     
    246248            $title['title'] .= ' - ' . __( 'WordPress plugin', 'wporg-plugins' );
    247249        }
     250
     251        // If results are paged and the max number of pages is known.
     252        if ( is_paged() && $wp_query->max_num_pages ) {
     253            // translators: 1: current page number, 2: total number of pages
     254            $title['page'] = sprintf(
     255                __( 'Page %1$s of %2$s', 'wporg-plugins' ),
     256                get_query_var( 'paged' ),
     257                $wp_query->max_num_pages
     258            );
     259        }
     260
    248261        $title['site'] = __( 'WordPress.org', 'wporg-plugins' );
    249262    }
Note: See TracChangeset for help on using the changeset viewer.