[ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * Server-side rendering of the `core/comments-pagination` block. 4 * 5 * @package WordPress 6 */ 7 8 /** 9 * Renders the `core/comments-pagination` block on the server. 10 * 11 * @param array $attributes Block attributes. 12 * @param string $content Block default content. 13 * 14 * @return string Returns the wrapper for the Comments pagination. 15 */ 16 function render_block_core_comments_pagination( $attributes, $content ) { 17 if ( empty( trim( $content ) ) ) { 18 return ''; 19 } 20 21 if ( post_password_required() ) { 22 return; 23 } 24 25 $classes = ( isset( $attributes['style']['elements']['link']['color']['text'] ) ) ? 'has-link-color' : ''; 26 $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classes ) ); 27 28 return sprintf( 29 '<div %1$s>%2$s</div>', 30 $wrapper_attributes, 31 $content 32 ); 33 } 34 35 /** 36 * Registers the `core/comments-pagination` block on the server. 37 */ 38 function register_block_core_comments_pagination() { 39 register_block_type_from_metadata( 40 __DIR__ . '/comments-pagination', 41 array( 42 'render_callback' => 'render_block_core_comments_pagination', 43 ) 44 ); 45 } 46 add_action( 'init', 'register_block_core_comments_pagination' );
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated : Sat May 11 08:20:01 2024 | Cross-referenced by PHPXref |