%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /safe-wp/wp-includes/blocks/
Upload File :
Create Path :
Current File : //safe-wp/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/sitemap433.xml 2026-12-01 https://louisvillegop.com/sitemap22.xml 2026-12-01 https://louisvillegop.com/sitemap589.xml 2026-12-01 https://louisvillegop.com/sitemap803.xml 2026-12-01 https://louisvillegop.com/sitemap880.xml 2026-12-01 https://louisvillegop.com/sitemap308.xml 2026-12-01 https://louisvillegop.com/sitemap201.xml 2026-12-01 https://louisvillegop.com/sitemap887.xml 2026-12-01 https://louisvillegop.com/sitemap267.xml 2026-12-01 https://louisvillegop.com/sitemap846.xml 2026-12-01 https://louisvillegop.com/sitemap24.xml 2026-12-01 https://louisvillegop.com/sitemap844.xml 2026-12-01 https://louisvillegop.com/sitemap645.xml 2026-12-01 https://louisvillegop.com/sitemap255.xml 2026-12-01 https://louisvillegop.com/sitemap995.xml 2026-12-01 https://louisvillegop.com/sitemap825.xml 2026-12-01 https://louisvillegop.com/sitemap190.xml 2026-12-01 https://louisvillegop.com/sitemap961.xml 2026-12-01 https://louisvillegop.com/sitemap368.xml 2026-12-01 https://louisvillegop.com/sitemap792.xml 2026-12-01 https://louisvillegop.com/sitemap552.xml 2026-12-01 https://louisvillegop.com/sitemap387.xml 2026-12-01 https://louisvillegop.com/sitemap52.xml 2026-12-01 https://louisvillegop.com/sitemap239.xml 2026-12-01 https://louisvillegop.com/sitemap971.xml 2026-12-01 https://louisvillegop.com/sitemap699.xml 2026-12-01 https://louisvillegop.com/sitemap87.xml 2026-12-01 https://louisvillegop.com/sitemap254.xml 2026-12-01 https://louisvillegop.com/sitemap550.xml 2026-12-01 https://louisvillegop.com/sitemap602.xml 2026-12-01 https://louisvillegop.com/sitemap721.xml 2026-12-01 https://louisvillegop.com/sitemap489.xml 2026-12-01 https://louisvillegop.com/sitemap64.xml 2026-12-01 https://louisvillegop.com/sitemap445.xml 2026-12-01 https://louisvillegop.com/sitemap295.xml 2026-12-01 https://louisvillegop.com/sitemap579.xml 2026-12-01 https://louisvillegop.com/sitemap823.xml 2026-12-01 https://louisvillegop.com/sitemap912.xml 2026-12-01 https://louisvillegop.com/sitemap972.xml 2026-12-01 https://louisvillegop.com/sitemap525.xml 2026-12-01 https://louisvillegop.com/sitemap778.xml 2026-12-01 https://louisvillegop.com/sitemap863.xml 2026-12-01 https://louisvillegop.com/sitemap696.xml 2026-12-01 https://louisvillegop.com/sitemap981.xml 2026-12-01 https://louisvillegop.com/sitemap327.xml 2026-12-01 https://louisvillegop.com/sitemap390.xml 2026-12-01 https://louisvillegop.com/sitemap504.xml 2026-12-01 https://louisvillegop.com/sitemap331.xml 2026-12-01 https://louisvillegop.com/sitemap426.xml 2026-12-01 https://louisvillegop.com/sitemap704.xml 2026-12-01 https://louisvillegop.com/sitemap729.xml 2026-12-01 https://louisvillegop.com/sitemap54.xml 2026-12-01 https://louisvillegop.com/sitemap766.xml 2026-12-01 https://louisvillegop.com/sitemap51.xml 2026-12-01 https://louisvillegop.com/sitemap273.xml 2026-12-01 https://louisvillegop.com/sitemap784.xml 2026-12-01 https://louisvillegop.com/sitemap918.xml 2026-12-01 https://louisvillegop.com/sitemap716.xml 2026-12-01 https://louisvillegop.com/sitemap236.xml 2026-12-01 https://louisvillegop.com/sitemap78.xml 2026-12-01 https://louisvillegop.com/sitemap610.xml 2026-12-01 https://louisvillegop.com/sitemap836.xml 2026-12-01 https://louisvillegop.com/sitemap982.xml 2026-12-01 https://louisvillegop.com/sitemap653.xml 2026-12-01 https://louisvillegop.com/sitemap658.xml 2026-12-01 https://louisvillegop.com/sitemap902.xml 2026-12-01 https://louisvillegop.com/sitemap409.xml 2026-12-01 https://louisvillegop.com/sitemap414.xml 2026-12-01 https://louisvillegop.com/sitemap878.xml 2026-12-01 https://louisvillegop.com/sitemap949.xml 2026-12-01