-
Notifications
You must be signed in to change notification settings - Fork 4.4k
/
Copy pathindex.php
71 lines (62 loc) · 1.92 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<?php
/**
* Server-side rendering of the `core/site-description` block.
*
* @package WordPress
*/
/**
* Renders the `core/site-description` block on the server.
*
* @return string The render.
*/
function render_block_core_site_description( $attributes ) {
$styles = '';
$class = 'wp-block-site-description';
if ( isset( $attributes['className'] ) ) {
$class .= ' ' . $attributes['className'];
}
if ( isset( $attributes['align'] ) ) {
$class .= ' align' . $attributes['align'];
}
if ( isset( $attributes['textAlign'] ) ) {
$class .= ' has-text-align-' . $attributes['textAlign'];
}
if ( isset( $attributes['textColor'] ) ) {
$class .= ' has-text-color';
$class .= ' has-' . $attributes['textColor'] . '-color';
} elseif ( isset( $attributes['customTextColor'] ) ) {
$class .= ' has-text-color';
$styles .= ' color: ' . $attributes['customTextColor'] . ';';
}
if ( isset( $attributes['backgroundColor'] ) ) {
$class .= ' has-background';
$class .= ' has-' . $attributes['backgroundColor'] . '-background-color';
} elseif ( isset( $attributes['customBackgroundColor'] ) ) {
$class .= ' has-background';
$styles .= ' background-color: ' . $attributes['customBackgroundColor'] . ';';
}
if ( isset( $attributes['fontSize'] ) ) {
$class .= ' has-' . $attributes['fontSize'] . '-font-size';
} elseif ( isset( $attributes['customFontSize'] ) ) {
$styles .= ' font-size: ' . $attributes['customFontSize'] . 'px;';
}
ob_start();
?>
<p class="<?php echo esc_attr( $class ); ?>" style="<?php echo esc_attr( $styles ); ?>">
<?php bloginfo( 'description' ); ?>
</p>
<?php
return ob_get_clean();
}
/**
* Registers the `core/site-description` block on the server.
*/
function register_block_core_site_description() {
register_block_type(
'core/site-description',
array(
'render_callback' => 'render_block_core_site_description',
)
);
}
add_action( 'init', 'register_block_core_site_description' );