equal
deleted
inserted
replaced
|
1 <?php |
|
2 /** |
|
3 * Server-side rendering of the `core/site-tagline` block. |
|
4 * |
|
5 * @package WordPress |
|
6 */ |
|
7 |
|
8 /** |
|
9 * Renders the `core/site-tagline` block on the server. |
|
10 * |
|
11 * @param array $attributes The block attributes. |
|
12 * |
|
13 * @return string The render. |
|
14 */ |
|
15 function render_block_core_site_tagline( $attributes ) { |
|
16 $site_tagline = get_bloginfo( 'description' ); |
|
17 if ( ! $site_tagline ) { |
|
18 return; |
|
19 } |
|
20 $align_class_name = empty( $attributes['textAlign'] ) ? '' : "has-text-align-{$attributes['textAlign']}"; |
|
21 $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $align_class_name ) ); |
|
22 |
|
23 return sprintf( |
|
24 '<p %1$s>%2$s</p>', |
|
25 $wrapper_attributes, |
|
26 $site_tagline |
|
27 ); |
|
28 } |
|
29 |
|
30 /** |
|
31 * Registers the `core/site-tagline` block on the server. |
|
32 */ |
|
33 function register_block_core_site_tagline() { |
|
34 register_block_type_from_metadata( |
|
35 __DIR__ . '/site-tagline', |
|
36 array( |
|
37 'render_callback' => 'render_block_core_site_tagline', |
|
38 ) |
|
39 ); |
|
40 } |
|
41 add_action( 'init', 'register_block_core_site_tagline' ); |