PATH:
var
/
www
/
clients
/
client1
/
web1
/
web
/
wp-includes
/
blocks
<?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 ( isset( $block->context['query']['inherit'] ) && $block->context['query']['inherit'] ) { $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 = isset( $_GET[ $page_key ] ) ? (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' );
[+]
..
[-] query-pagination-numbers.php
[edit]
[-] archives.php
[edit]
[+]
term-count
[-] blocks-json.php
[edit]
[-] require-static-blocks.php
[edit]
[+]
comments-pagination-previous
[+]
post-featured-image
[+]
post-title
[+]
preformatted
[+]
post-comments-count
[-] shortcode.php
[edit]
[+]
list
[-] post-title.php
[edit]
[+]
table
[-] loginout.php
[edit]
[-] file.php
[edit]
[+]
legacy-widget
[-] query-pagination.php
[edit]
[+]
comments-pagination-next
[+]
accordion
[-] post-time-to-read.php
[edit]
[+]
post-author-biography
[+]
comment-edit-link
[+]
block
[+]
comment-reply-link
[+]
search
[+]
page-list
[+]
pullquote
[-] query-pagination-next.php
[edit]
[+]
navigation
[+]
social-link
[+]
accordion-item
[-] categories.php
[edit]
[+]
avatar
[-] post-terms.php
[edit]
[+]
image
[+]
post-content
[+]
comment-author-name
[+]
comment-date
[+]
button
[-] query-total.php
[edit]
[-] comments-pagination.php
[edit]
[-] tag-cloud.php
[edit]
[-] index.php
[edit]
[-] pattern.php
[edit]
[+]
comments
[-] term-description.php
[edit]
[+]
post-excerpt
[-] latest-posts.php
[edit]
[-] post-comments-form.php
[edit]
[-] comment-author-name.php
[edit]
[-] comment-template.php
[edit]
[+]
html
[+]
post-author-name
[-] comments-pagination-next.php
[edit]
[-] post-date.php
[edit]
[-] gallery.php
[edit]
[-] require-dynamic-blocks.php
[edit]
[+]
site-logo
[+]
widget-group
[-] site-logo.php
[edit]
[-] navigation.php
[edit]
[+]
spacer
[-] rss.php
[edit]
[-] accordion-item.php
[edit]
[-] cover.php
[edit]
[+]
file
[-] post-author-name.php
[edit]
[+]
post-comments-link
[-] comments-pagination-previous.php
[edit]
[+]
comment-content
[+]
columns
[-] query.php
[edit]
[+]
post-time-to-read
[+]
query-pagination-next
[+]
pattern
[+]
home-link
[+]
math
[-] avatar.php
[edit]
[+]
navigation-link
[-] post-featured-image.php
[edit]
[-] term-template.php
[edit]
[-] site-title.php
[edit]
[+]
comments-pagination-numbers
[+]
query-no-results
[+]
group
[+]
loginout
[+]
archives
[+]
social-links
[+]
cover
[-] block.php
[edit]
[-] post-content.php
[edit]
[+]
freeform
[+]
shortcode
[-] media-text.php
[edit]
[-] navigation-link.php
[edit]
[+]
post-comments-form
[-] navigation-submenu.php
[edit]
[+]
post-navigation-link
[-] comments.php
[edit]
[+]
comment-template
[-] term-name.php
[edit]
[-] latest-comments.php
[edit]
[+]
query-pagination-previous
[+]
term-description
[-] widget-group.php
[edit]
[-] social-link.php
[edit]
[+]
separator
[+]
post-date
[-] query-pagination-previous.php
[edit]
[+]
nextpage
[+]
tag-cloud
[+]
categories
[-] post-navigation-link.php
[edit]
[+]
template-part
[+]
accordion-panel
[-] list.php
[edit]
[+]
video
[-] accordion.php
[edit]
[+]
term-name
[+]
media-text
[-] post-author-biography.php
[edit]
[+]
read-more
[+]
query-total
[-] video.php
[edit]
[+]
embed
[+]
audio
[-] calendar.php
[edit]
[+]
code
[-] legacy-widget.php
[edit]
[+]
latest-posts
[-] comment-reply-link.php
[edit]
[-] home-link.php
[edit]
[-] image.php
[edit]
[-] page-list-item.php
[edit]
[+]
heading
[+]
navigation-submenu
[+]
verse
[+]
paragraph
[+]
site-tagline
[+]
gallery
[-] post-comments-count.php
[edit]
[-] comments-pagination-numbers.php
[edit]
[+]
quote
[-] post-excerpt.php
[edit]
[+]
query-pagination
[-] post-comments-link.php
[edit]
[+]
more
[+]
latest-comments
[+]
rss
[-] read-more.php
[edit]
[+]
post-template
[+]
footnotes
[-] comment-content.php
[edit]
[-] term-count.php
[edit]
[+]
site-title
[-] page-list.php
[edit]
[+]
comments-title
[-] button.php
[edit]
[-] comment-edit-link.php
[edit]
[+]
missing
[-] site-tagline.php
[edit]
[-] heading.php
[edit]
[+]
page-list-item
[+]
buttons
[-] post-template.php
[edit]
[+]
column
[-] post-author.php
[edit]
[+]
query
[+]
list-item
[+]
query-pagination-numbers
[-] template-part.php
[edit]
[+]
accordion-heading
[+]
post-author
[-] footnotes.php
[edit]
[-] comment-date.php
[edit]
[+]
query-title
[+]
comments-pagination
[-] query-title.php
[edit]
[+]
term-template
[-] query-no-results.php
[edit]
[+]
text-columns
[+]
post-terms
[-] comments-title.php
[edit]
[+]
calendar
[+]
terms-query
[-] search.php
[edit]
[+]
details