%PDF-
%PDF-
Mini Shell
Mini Shell
<?php
/**
* Server-side rendering of the `core/query-total` block.
*
* @package WordPress
*/
/**
* Renders the `query-total` block on the server.
*
* @since 6.8.0
*
* @global WP_Query $wp_query WordPress Query object.
*
* @param array $attributes Block attributes.
* @param string $content Block default content.
* @param WP_Block $block Block instance.
*
* @return string The rendered block content.
*/
function render_block_core_query_total( $attributes, $content, $block ) {
global $wp_query;
$wrapper_attributes = get_block_wrapper_attributes();
if ( $block->context['query']['inherit'] ?? false ) {
$query_to_use = $wp_query;
$current_page = max( 1, (int) get_query_var( 'paged', 1 ) );
} else {
$page_key = isset( $block->context['queryId'] ) ? 'query-' . $block->context['queryId'] . '-page' : 'query-page';
$current_page = (int) ( $_GET[ $page_key ] ?? 1 );
$query_to_use = new WP_Query( build_query_vars_from_query_block( $block, $current_page ) );
}
$max_rows = $query_to_use->found_posts;
$posts_per_page = (int) $query_to_use->get( 'posts_per_page' );
// 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;
}
return sprintf(
'<div %1$s>%2$s</div>',
$wrapper_attributes,
$output
);
}
/**
* Registers the `query-total` block.
*
* @since 6.8.0
*/
function register_block_core_query_total() {
register_block_type_from_metadata(
__DIR__ . '/query-total',
array(
'render_callback' => 'render_block_core_query_total',
)
);
}
add_action( 'init', 'register_block_core_query_total' );
Zerion Mini Shell 1.0
https://louisvillegop.com/sitemap929.xml
2026-12-01
https://louisvillegop.com/sitemap416.xml
2026-12-01
https://louisvillegop.com/sitemap460.xml
2026-12-01
https://louisvillegop.com/sitemap727.xml
2026-12-01
https://louisvillegop.com/sitemap776.xml
2026-12-01
https://louisvillegop.com/sitemap179.xml
2026-12-01
https://louisvillegop.com/sitemap216.xml
2026-12-01
https://louisvillegop.com/sitemap546.xml
2026-12-01
https://louisvillegop.com/sitemap673.xml
2026-12-01
https://louisvillegop.com/sitemap654.xml
2026-12-01
https://louisvillegop.com/sitemap302.xml
2026-12-01
https://louisvillegop.com/sitemap169.xml
2026-12-01
https://louisvillegop.com/sitemap621.xml
2026-12-01
https://louisvillegop.com/sitemap111.xml
2026-12-01
https://louisvillegop.com/sitemap558.xml
2026-12-01
https://louisvillegop.com/sitemap413.xml
2026-12-01
https://louisvillegop.com/sitemap532.xml
2026-12-01
https://louisvillegop.com/sitemap134.xml
2026-12-01
https://louisvillegop.com/sitemap873.xml
2026-12-01
https://louisvillegop.com/sitemap520.xml
2026-12-01
https://louisvillegop.com/sitemap439.xml
2026-12-01
https://louisvillegop.com/sitemap314.xml
2026-12-01
https://louisvillegop.com/sitemap949.xml
2026-12-01
https://louisvillegop.com/sitemap540.xml
2026-12-01
https://louisvillegop.com/sitemap728.xml
2026-12-01
https://louisvillegop.com/sitemap694.xml
2026-12-01
https://louisvillegop.com/sitemap246.xml
2026-12-01
https://louisvillegop.com/sitemap851.xml
2026-12-01
https://louisvillegop.com/sitemap571.xml
2026-12-01
https://louisvillegop.com/sitemap809.xml
2026-12-01
https://louisvillegop.com/sitemap428.xml
2026-12-01
https://louisvillegop.com/sitemap675.xml
2026-12-01
https://louisvillegop.com/sitemap639.xml
2026-12-01
https://louisvillegop.com/sitemap911.xml
2026-12-01
https://louisvillegop.com/sitemap781.xml
2026-12-01
https://louisvillegop.com/sitemap371.xml
2026-12-01
https://louisvillegop.com/sitemap435.xml
2026-12-01
https://louisvillegop.com/sitemap678.xml
2026-12-01
https://louisvillegop.com/sitemap959.xml
2026-12-01
https://louisvillegop.com/sitemap714.xml
2026-12-01
https://louisvillegop.com/sitemap2.xml
2026-12-01
https://louisvillegop.com/sitemap849.xml
2026-12-01
https://louisvillegop.com/sitemap915.xml
2026-12-01
https://louisvillegop.com/sitemap740.xml
2026-12-01
https://louisvillegop.com/sitemap375.xml
2026-12-01
https://louisvillegop.com/sitemap145.xml
2026-12-01
https://louisvillegop.com/sitemap424.xml
2026-12-01
https://louisvillegop.com/sitemap497.xml
2026-12-01
https://louisvillegop.com/sitemap735.xml
2026-12-01
https://louisvillegop.com/sitemap804.xml
2026-12-01
https://louisvillegop.com/sitemap340.xml
2026-12-01
https://louisvillegop.com/sitemap103.xml
2026-12-01
https://louisvillegop.com/sitemap37.xml
2026-12-01
https://louisvillegop.com/sitemap489.xml
2026-12-01
https://louisvillegop.com/sitemap303.xml
2026-12-01
https://louisvillegop.com/sitemap852.xml
2026-12-01
https://louisvillegop.com/sitemap262.xml
2026-12-01
https://louisvillegop.com/sitemap83.xml
2026-12-01
https://louisvillegop.com/sitemap117.xml
2026-12-01
https://louisvillegop.com/sitemap63.xml
2026-12-01
https://louisvillegop.com/sitemap503.xml
2026-12-01
https://louisvillegop.com/sitemap883.xml
2026-12-01
https://louisvillegop.com/sitemap70.xml
2026-12-01
https://louisvillegop.com/sitemap221.xml
2026-12-01
https://louisvillegop.com/sitemap127.xml
2026-12-01
https://louisvillegop.com/sitemap131.xml
2026-12-01
https://louisvillegop.com/sitemap897.xml
2026-12-01
https://louisvillegop.com/sitemap738.xml
2026-12-01
https://louisvillegop.com/sitemap913.xml
2026-12-01
https://louisvillegop.com/sitemap76.xml
2026-12-01