// Calculate the range of posts being displayed. $start = ( 0 === $max_rows ) ? 0 : ( ( $current_page - 1 ) * $posts_per_page + 1 ); $end = min( $start + $posts_per_page - 1, $max_rows );
// Prepare the display based on the `displayType` attribute. $output = ''; switch ( $attributes['displayType'] ) { case 'range-display': if ( $start === $end ) { $output = sprintf( /* translators: 1: Start index of posts, 2: Total number of posts */ __( 'Displaying %1$s of %2$s' ), $start, $max_rows ); } else { $output = sprintf( /* translators: 1: Start index of posts, 2: End index of posts, 3: Total number of posts */ __( 'Displaying %1$s – %2$s of %3$s' ), $start, $end, $max_rows ); }
break;
case 'total-results': default: // translators: %d: number of results. $output = sprintf( _n( '%d result found', '%d results found', $max_rows ), $max_rows ); break; }