PATH:
home
/
thecwrif
/
public_html
/
wp-includes
/
blocks
<?php /** * Server-side rendering of the `core/term-count` block. * * @package WordPress */ /** * Renders the `core/term-count` block on the server. * * @since 6.9.0 * * @param array $attributes Block attributes. * @param string $content Block default content. * @param WP_Block $block Block instance. * * @return string Returns the count of the current taxonomy term wrapped inside a heading tag. */ function render_block_core_term_count( $attributes, $content, $block ) { // Get term from context or from the current query. if ( isset( $block->context['termId'] ) && isset( $block->context['taxonomy'] ) ) { $term = get_term( $block->context['termId'], $block->context['taxonomy'] ); } else { $term = get_queried_object(); if ( ! $term instanceof WP_Term ) { $term = null; } } if ( ! $term || is_wp_error( $term ) ) { return ''; } $term_count = $term->count; // Format the term count based on bracket type. switch ( $attributes['bracketType'] ) { case 'none': // No formatting needed. break; case 'round': $term_count = "({$term_count})"; break; case 'square': $term_count = "[{$term_count}]"; break; case 'curly': $term_count = "{{$term_count}}"; break; case 'angle': $term_count = "<{$term_count}>"; break; default: // Default to no formatting for unknown types. break; } $wrapper_attributes = get_block_wrapper_attributes(); return sprintf( '<div %1$s>%2$s</div>', $wrapper_attributes, $term_count ); } /** * Registers the `core/term-count` block on the server. * * @since 6.9.0 */ function register_block_core_term_count() { register_block_type_from_metadata( __DIR__ . '/term-count', array( 'render_callback' => 'render_block_core_term_count', ) ); } add_action( 'init', 'register_block_core_term_count' );
[+]
..
[+]
terms-query
[+]
comment-edit-link
[+]
list
[-] query-total.php
[edit]
[-] media-text.php
[edit]
[+]
site-tagline
[+]
audio
[-] blocks-json.php
[edit]
[+]
navigation-submenu
[+]
post-date
[+]
comments-pagination-next
[-] comments-pagination-next.php
[edit]
[+]
post-author-biography
[-] navigation-submenu.php
[edit]
[+]
navigation
[+]
home-link
[+]
query-pagination-numbers
[-] tag-cloud.php
[edit]
[-] shortcode.php
[edit]
[-] list.php
[edit]
[-] term-description.php
[edit]
[-] page-list-item.php
[edit]
[+]
social-links
[-] post-comments-count.php
[edit]
[+]
post-comments-link
[+]
file
[-] pattern.php
[edit]
[+]
latest-posts
[+]
post-navigation-link
[-] post-author-biography.php
[edit]
[-] footnotes.php
[edit]
[+]
post-template
[-] post-title.php
[edit]
[+]
preformatted
[-] query-pagination-next.php
[edit]
[+]
paragraph
[+]
page-list
[+]
post-comments-count
[+]
term-count
[-] post-terms.php
[edit]
[+]
navigation-link
[-] accordion.php
[edit]
[-] post-time-to-read.php
[edit]
[+]
query-pagination-next
[-] template-part.php
[edit]
[-] home-link.php
[edit]
[+]
categories
[+]
site-title
[+]
avatar
[+]
comment-content
[+]
shortcode
[-] site-title.php
[edit]
[+]
term-template
[+]
embed
[+]
verse
[+]
template-part
[-] loginout.php
[edit]
[-] rss.php
[edit]
[-] page-list.php
[edit]
[+]
accordion-panel
[+]
latest-comments
[-] heading.php
[edit]
[+]
more
[+]
quote
[+]
comments
[-] search.php
[edit]
[-] comment-date.php
[edit]
[-] error_log
[edit]
[-] latest-comments.php
[edit]
[+]
post-comments-form
[+]
text-columns
[-] require-dynamic-blocks.php
[edit]
[-] block.php
[edit]
[+]
read-more
[+]
nextpage
[+]
columns
[-] term-name.php
[edit]
[-] calendar.php
[edit]
[+]
group
[+]
query-title
[-] post-template.php
[edit]
[+]
separator
[+]
pullquote
[-] post-date.php
[edit]
[-] comment-author-name.php
[edit]
[-] query-no-results.php
[edit]
[-] site-logo.php
[edit]
[+]
post-author
[-] read-more.php
[edit]
[+]
video
[+]
comment-reply-link
[-] image.php
[edit]
[-] comment-edit-link.php
[edit]
[-] navigation.php
[edit]
[-] comments-pagination.php
[edit]
[+]
post-title
[+]
query-no-results
[+]
widget-group
[-] comment-template.php
[edit]
[+]
query-total
[+]
rss
[+]
social-link
[-] post-author-name.php
[edit]
[+]
column
[+]
buttons
[-] term-count.php
[edit]
[-] comments.php
[edit]
[+]
spacer
[+]
code
[-] index.php
[edit]
[+]
site-logo
[+]
image
[+]
table
[+]
query-pagination
[+]
footnotes
[-] button.php
[edit]
[+]
comments-title
[+]
pattern
[+]
cover
[+]
list-item
[+]
block
[+]
media-text
[-] comment-content.php
[edit]
[-] term-template.php
[edit]
[+]
post-author-name
[-] post-comments-link.php
[edit]
[-] file.php
[edit]
[-] social-link.php
[edit]
[+]
details
[+]
tag-cloud
[-] gallery.php
[edit]
[-] widget-group.php
[edit]
[-] comments-title.php
[edit]
[+]
heading
[-] query-pagination-numbers.php
[edit]
[+]
query
[+]
gallery
[-] post-navigation-link.php
[edit]
[-] post-excerpt.php
[edit]
[+]
legacy-widget
[+]
post-featured-image
[+]
button
[+]
html
[-] post-content.php
[edit]
[-] query.php
[edit]
[-] accordion-item.php
[edit]
[-] post-comments-form.php
[edit]
[+]
page-list-item
[-] query-title.php
[edit]
[-] cover.php
[edit]
[-] comment-reply-link.php
[edit]
[+]
archives
[-] archives.php
[edit]
[-] categories.php
[edit]
[+]
accordion-heading
[+]
post-excerpt
[+]
query-pagination-previous
[+]
freeform
[+]
search
[-] comments-pagination-numbers.php
[edit]
[-] latest-posts.php
[edit]
[-] navigation-link.php
[edit]
[+]
loginout
[+]
comments-pagination
[-] site-tagline.php
[edit]
[+]
comments-pagination-previous
[+]
math
[-] post-author.php
[edit]
[-] query-pagination.php
[edit]
[+]
post-content
[-] require-static-blocks.php
[edit]
[+]
accordion
[+]
post-time-to-read
[+]
calendar
[+]
comment-date
[+]
comments-pagination-numbers
[-] comments-pagination-previous.php
[edit]
[+]
term-name
[+]
term-description
[-] avatar.php
[edit]
[+]
comment-template
[+]
accordion-item
[-] legacy-widget.php
[edit]
[+]
post-terms
[-] query-pagination-previous.php
[edit]
[-] post-featured-image.php
[edit]
[-] video.php
[edit]
[+]
missing
[+]
comment-author-name