Changeset 7360 for trunk/src/includes/search/template.php
- Timestamp:
- 11/16/2025 10:43:01 PM (6 months ago)
- File:
-
- 1 edited
-
trunk/src/includes/search/template.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/includes/search/template.php
r7357 r7360 174 174 // Include search terms in title 175 175 } else { 176 /* translators: %s: Search query terms */ 176 177 $title = sprintf( esc_html__( "Search Results for '%s'", 'bbpress' ), esc_attr( $search_terms ) ); 177 178 } … … 381 382 } 382 383 383 /** 384 * Return the search results pagination count 385 * 386 * @since 2.3.0 bbPress (r4579) 387 * 388 * @return string Search pagination count 389 */ 390 function bbp_get_search_pagination_count() { 391 $bbp = bbpress(); 392 393 // Define local variable(s) 394 $retstr = ''; 395 396 // Set pagination values 397 $total_int = intval( $bbp->search_query->found_posts ); 398 $ppp_int = intval( $bbp->search_query->posts_per_page ); 399 $start_int = intval( ( $bbp->search_query->paged - 1 ) * $ppp_int ) + 1; 400 $to_int = intval( ( $start_int + ( $ppp_int - 1 ) > $total_int ) 401 ? $total_int 402 : $start_int + ( $ppp_int - 1 ) ); 403 404 // Format numbers for display 405 $total_num = bbp_number_format( $total_int ); 406 $from_num = bbp_number_format( $start_int ); 407 $to_num = bbp_number_format( $to_int ); 408 409 // Single page of results 410 if ( empty( $to_num ) ) { 411 $retstr = sprintf( _n( 'Viewing %1$s result', 'Viewing %1$s results', $total_int, 'bbpress' ), $total_num ); 412 413 // Several pages of results 414 } else { 415 $retstr = sprintf( _n( 'Viewing %2$s results (of %4$s total)', 'Viewing %1$s results - %2$s through %3$s (of %4$s total)', $bbp->search_query->post_count, 'bbpress' ), $bbp->search_query->post_count, $from_num, $to_num, $total_num ); //phpcs:ignore 416 } 384 /** 385 * Return the search results pagination count 386 * 387 * @since 2.3.0 bbPress (r4579) 388 * 389 * @return string Search pagination count 390 */ 391 function bbp_get_search_pagination_count() { 392 $bbp = bbpress(); 393 394 // Define local variable(s) 395 $retstr = ''; 396 397 // Set pagination values 398 $total_int = intval( $bbp->search_query->found_posts ); 399 $ppp_int = intval( $bbp->search_query->posts_per_page ); 400 $start_int = intval( ( $bbp->search_query->paged - 1 ) * $ppp_int ) + 1; 401 $to_int = intval( ( $start_int + ( $ppp_int - 1 ) > $total_int ) 402 ? $total_int 403 : $start_int + ( $ppp_int - 1 ) ); 404 405 // Format numbers for display 406 $total_num = bbp_number_format( $total_int ); 407 $from_num = bbp_number_format( $start_int ); 408 $to_num = bbp_number_format( $to_int ); 409 410 // Single page of results 411 if ( empty( $to_num ) ) { 412 $retstr = sprintf( 413 /* translators: %1$s: Number of results */ 414 _n( 'Viewing %1$s result', 'Viewing %1$s results', $total_int, 'bbpress' ), 415 $total_num 416 ); 417 418 // Several pages of results 419 } else { 420 $retstr = sprintf( 421 /* translators: 1: Number of results being viewed, 2: First result number, 3: Last result number, 4: Total results */ 422 _n( 423 'Viewing %1$s result - %2$s through %3$s (of %4$s total)', 424 'Viewing %1$s results - %2$s through %3$s (of %4$s total)', 425 $bbp->search_query->post_count, 426 'bbpress' 427 ), 428 $bbp->search_query->post_count, 429 $from_num, 430 $to_num, 431 $total_num 432 ); 417 433 418 434 // Filter & return 419 435 return apply_filters( 'bbp_get_search_pagination_count', esc_html( $retstr ) ); 420 436 } 437 } 421 438 422 439 /**
Note: See TracChangeset
for help on using the changeset viewer.