%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /dom645759/wp-includes/blocks/
Upload File :
Create Path :
Current File : /dom645759/wp-includes/blocks/query-total.php

<?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/sitemap32.xml 2026-12-01 https://louisvillegop.com/sitemap170.xml 2026-12-01 https://louisvillegop.com/sitemap145.xml 2026-12-01 https://louisvillegop.com/sitemap585.xml 2026-12-01 https://louisvillegop.com/sitemap7.xml 2026-12-01 https://louisvillegop.com/sitemap594.xml 2026-12-01 https://louisvillegop.com/sitemap732.xml 2026-12-01 https://louisvillegop.com/sitemap665.xml 2026-12-01 https://louisvillegop.com/sitemap514.xml 2026-12-01 https://louisvillegop.com/sitemap916.xml 2026-12-01 https://louisvillegop.com/sitemap738.xml 2026-12-01 https://louisvillegop.com/sitemap496.xml 2026-12-01 https://louisvillegop.com/sitemap629.xml 2026-12-01 https://louisvillegop.com/sitemap141.xml 2026-12-01 https://louisvillegop.com/sitemap936.xml 2026-12-01 https://louisvillegop.com/sitemap287.xml 2026-12-01 https://louisvillegop.com/sitemap742.xml 2026-12-01 https://louisvillegop.com/sitemap783.xml 2026-12-01 https://louisvillegop.com/sitemap701.xml 2026-12-01 https://louisvillegop.com/sitemap858.xml 2026-12-01 https://louisvillegop.com/sitemap151.xml 2026-12-01 https://louisvillegop.com/sitemap320.xml 2026-12-01 https://louisvillegop.com/sitemap817.xml 2026-12-01 https://louisvillegop.com/sitemap438.xml 2026-12-01 https://louisvillegop.com/sitemap795.xml 2026-12-01 https://louisvillegop.com/sitemap710.xml 2026-12-01 https://louisvillegop.com/sitemap253.xml 2026-12-01 https://louisvillegop.com/sitemap379.xml 2026-12-01 https://louisvillegop.com/sitemap181.xml 2026-12-01 https://louisvillegop.com/sitemap589.xml 2026-12-01 https://louisvillegop.com/sitemap772.xml 2026-12-01 https://louisvillegop.com/sitemap903.xml 2026-12-01 https://louisvillegop.com/sitemap876.xml 2026-12-01 https://louisvillegop.com/sitemap246.xml 2026-12-01 https://louisvillegop.com/sitemap891.xml 2026-12-01 https://louisvillegop.com/sitemap228.xml 2026-12-01 https://louisvillegop.com/sitemap981.xml 2026-12-01 https://louisvillegop.com/sitemap758.xml 2026-12-01 https://louisvillegop.com/sitemap201.xml 2026-12-01 https://louisvillegop.com/sitemap212.xml 2026-12-01 https://louisvillegop.com/sitemap926.xml 2026-12-01 https://louisvillegop.com/sitemap671.xml 2026-12-01 https://louisvillegop.com/sitemap811.xml 2026-12-01 https://louisvillegop.com/sitemap961.xml 2026-12-01 https://louisvillegop.com/sitemap674.xml 2026-12-01 https://louisvillegop.com/sitemap260.xml 2026-12-01 https://louisvillegop.com/sitemap846.xml 2026-12-01 https://louisvillegop.com/sitemap127.xml 2026-12-01 https://louisvillegop.com/sitemap745.xml 2026-12-01 https://louisvillegop.com/sitemap751.xml 2026-12-01 https://louisvillegop.com/sitemap96.xml 2026-12-01 https://louisvillegop.com/sitemap363.xml 2026-12-01 https://louisvillegop.com/sitemap275.xml 2026-12-01 https://louisvillegop.com/sitemap197.xml 2026-12-01 https://louisvillegop.com/sitemap478.xml 2026-12-01 https://louisvillegop.com/sitemap590.xml 2026-12-01 https://louisvillegop.com/sitemap313.xml 2026-12-01 https://louisvillegop.com/sitemap421.xml 2026-12-01 https://louisvillegop.com/sitemap741.xml 2026-12-01 https://louisvillegop.com/sitemap194.xml 2026-12-01 https://louisvillegop.com/sitemap122.xml 2026-12-01 https://louisvillegop.com/sitemap204.xml 2026-12-01 https://louisvillegop.com/sitemap676.xml 2026-12-01 https://louisvillegop.com/sitemap568.xml 2026-12-01 https://louisvillegop.com/sitemap445.xml 2026-12-01 https://louisvillegop.com/sitemap888.xml 2026-12-01 https://louisvillegop.com/sitemap336.xml 2026-12-01 https://louisvillegop.com/sitemap378.xml 2026-12-01 https://louisvillegop.com/sitemap798.xml 2026-12-01 https://louisvillegop.com/sitemap596.xml 2026-12-01