[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/blocks/ -> post-time-to-read.php (summary)

Server-side rendering of the `core/post-time-to-read` block.

File Size: 185 lines (6 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 3 functions

  block_core_post_time_to_read_word_count()
  render_block_core_post_time_to_read()
  register_block_core_post_time_to_read()

Functions
Functions that are not part of a class:

block_core_post_time_to_read_word_count( $text, $type )   X-Ref
Counts words or characters in a provided text string.

This function currently employs an array of regular expressions
to parse HTML and count words, which may result in inaccurate
word counts. However, it is designed primarily to agree with the
corresponding JavaScript function.

Any improvements in the word counting, for example with the HTML API
and {@see \IntlBreakIterator::createWordInstance()} should coordinate
with changes to the JavaScript implementation to ensure consistency
between the editor and the rendered page.

return: string The rendered word count.
param: string $text Text to count elements in.
param: string $type The type of count. Accepts 'words', 'characters_excluding_spaces', or 'characters_including_spaces'.

render_block_core_post_time_to_read( $attributes, $content, $block )   X-Ref
Renders the `core/post-time-to-read` block on the server.

return: string Returns the rendered post author name block.
param: array    $attributes Block attributes.
param: string   $content    Block default content.
param: WP_Block $block      Block instance.

register_block_core_post_time_to_read()   X-Ref
Registers the `core/post-time-to-read` block on the server.




Generated : Wed Oct 22 08:20:04 2025 Cross-referenced by PHPXref