mirror of
https://github.com/WordPress/WordPress.git
synced 2024-08-26 23:59:40 +02:00
The commit updates the WordPress packages for beta 3. Props nosolosw, noisysocks, youknowriad. See #53397. Built from https://develop.svn.wordpress.org/trunk@51199 git-svn-id: http://core.svn.wordpress.org/trunk@50808 1a063a9b-81f0-0310-95a4-ce76da25c4cd
42 lines
994 B
PHP
42 lines
994 B
PHP
<?php
|
|
/**
|
|
* Server-side rendering of the `core/site-tagline` block.
|
|
*
|
|
* @package WordPress
|
|
*/
|
|
|
|
/**
|
|
* Renders the `core/site-tagline` block on the server.
|
|
*
|
|
* @param array $attributes The block attributes.
|
|
*
|
|
* @return string The render.
|
|
*/
|
|
function render_block_core_site_tagline( $attributes ) {
|
|
$site_tagline = get_bloginfo( 'description' );
|
|
if ( ! $site_tagline ) {
|
|
return;
|
|
}
|
|
$align_class_name = empty( $attributes['textAlign'] ) ? '' : "has-text-align-{$attributes['textAlign']}";
|
|
$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $align_class_name ) );
|
|
|
|
return sprintf(
|
|
'<p %1$s>%2$s</p>',
|
|
$wrapper_attributes,
|
|
$site_tagline
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Registers the `core/site-tagline` block on the server.
|
|
*/
|
|
function register_block_core_site_tagline() {
|
|
register_block_type_from_metadata(
|
|
__DIR__ . '/site-tagline',
|
|
array(
|
|
'render_callback' => 'render_block_core_site_tagline',
|
|
)
|
|
);
|
|
}
|
|
add_action( 'init', 'register_block_core_site_tagline' );
|