PATH:
home
/
bnathsfovv
/
amundtveit.info
/
wp-includes
/
blocks
<?php /** * Server-side rendering of the `core/post-comments-link` block. * * @package WordPress */ /** * Renders the `core/post-comments-link` 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 rendered link. */ function render_block_core_post_comments_link( $attributes, $content, $block ) { if ( ! isset( $block->context['postId'] ) || isset( $block->context['postId'] ) && ! comments_open( $block->context['postId'] ) ) { return ''; } $classes = array(); if ( isset( $attributes['textAlign'] ) ) { $classes[] = 'has-text-align-' . $attributes['textAlign']; } if ( isset( $attributes['style']['elements']['link']['color']['text'] ) ) { $classes[] = 'has-link-color'; } $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => implode( ' ', $classes ) ) ); $comments_number = (int) get_comments_number( $block->context['postId'] ); $comments_link = get_comments_link( $block->context['postId'] ); $post_title = get_the_title( $block->context['postId'] ); $comment_html = ''; if ( 0 === $comments_number ) { $comment_html = sprintf( /* translators: %s post title */ __( 'No comments<span class="screen-reader-text"> on %s</span>' ), $post_title ); } else { $comment_html = sprintf( /* translators: 1: Number of comments, 2: post title */ _n( '%1$s comment<span class="screen-reader-text"> on %2$s</span>', '%1$s comments<span class="screen-reader-text"> on %2$s</span>', $comments_number ), esc_html( number_format_i18n( $comments_number ) ), $post_title ); } return '<div ' . $wrapper_attributes . '><a href=' . esc_url( $comments_link ) . '>' . $comment_html . '</a></div>'; } /** * Registers the `core/post-comments-link` block on the server. * * @since 6.9.0 */ function register_block_core_post_comments_link() { register_block_type_from_metadata( __DIR__ . '/post-comments-link', array( 'render_callback' => 'render_block_core_post_comments_link', ) ); } add_action( 'init', 'register_block_core_post_comments_link' );
[+]
..
[+]
legacy-widget
[-] file.php
[edit]
[+]
spacer
[+]
html
[+]
query-total
[+]
audio
[+]
comments-title
[+]
accordion-panel
[+]
query-pagination-numbers
[-] query-total.php
[edit]
[+]
comment-template
[+]
list-item
[-] gallery.php
[edit]
[+]
comment-author-name
[-] site-logo.php
[edit]
[+]
categories
[+]
post-comments-link
[+]
verse
[+]
term-name
[+]
accordion-heading
[+]
widget-group
[+]
template-part
[+]
comments-pagination-numbers
[+]
comment-content
[+]
query-pagination-previous
[+]
comment-reply-link
[-] site-tagline.php
[edit]
[+]
query-pagination
[+]
code
[+]
breadcrumbs
[+]
post-comments-form
[-] media-text.php
[edit]
[+]
group
[+]
page-list
[-] tag-cloud.php
[edit]
[+]
post-excerpt
[+]
post-time-to-read
[+]
more
[+]
rss
[+]
media-text
[+]
separator
[-] block.php
[edit]
[-] post-excerpt.php
[edit]
[+]
button
[+]
read-more
[+]
comments-pagination-next
[+]
table
[-] template-part.php
[edit]
[-] navigation-link.php
[edit]
[+]
term-count
[+]
latest-comments
[+]
missing
[+]
nextpage
[-] post-terms.php
[edit]
[+]
post-comments-count
[+]
comments-pagination
[+]
image
[+]
embed
[+]
social-links
[+]
terms-query
[-] post-comments-link.php
[edit]
[+]
block
[+]
heading
[+]
details
[+]
preformatted
[+]
loginout
[+]
post-title
[+]
comment-edit-link
[+]
post-author-name
[+]
post-terms
[+]
post-date
[+]
comments-pagination-previous
[+]
footnotes
[+]
post-author
[+]
site-title
[+]
post-content
[+]
home-link
[-] post-time-to-read.php
[edit]
[+]
page-list-item
[+]
comments
[+]
query-no-results
[-] term-name.php
[edit]
[+]
latest-posts
[+]
navigation
[-] comment-date.php
[edit]
[+]
shortcode
[+]
paragraph
[-] index.php
[edit]
[+]
quote
[-] .htaccess
[edit]
[+]
pattern
[-] blocks-json.php
[edit]
[+]
post-template
[+]
buttons
[+]
site-tagline
[+]
columns
[+]
navigation-overlay-close
[-] page-list-item.php
[edit]
[+]
math
[+]
navigation-submenu
[-] comment-template.php
[edit]
[-] comments-pagination.php
[edit]
[+]
navigation-link
[+]
post-navigation-link
[+]
post-author-biography
[+]
text-columns
[-] footnotes.php
[edit]
[+]
calendar
[+]
gallery
[-] comments-pagination-next.php
[edit]
[+]
post-featured-image
[+]
avatar
[+]
term-template
[+]
search
[+]
list
[+]
term-description
[+]
query
[-] page-list.php
[edit]
[-] accordion-item.php
[edit]
[+]
accordion-item
[-] post-date.php
[edit]
[-] home-link.php
[edit]
[-] search.php
[edit]
[+]
site-logo
[-] term-template.php
[edit]
[-] accordion.php
[edit]
[-] avatar.php
[edit]
[+]
column
[-] cover.php
[edit]
[+]
archives
[+]
accordion
[+]
social-link
[+]
file
[+]
query-pagination-next
[+]
comment-date
[-] post-navigation-link.php
[edit]
[+]
tag-cloud
[-] query-pagination-numbers.php
[edit]
[+]
icon
[+]
freeform
[+]
pullquote
[+]
query-title
[+]
video
[+]
cover