-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add block attributes PHP definitions and UI
- Loading branch information
Showing
4 changed files
with
125 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?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() { | ||
return sprintf( '<p>%s</p>', get_bloginfo( 'description' ) ); | ||
} | ||
|
||
/** | ||
* Registers the `core/site-description` block on the server. | ||
*/ | ||
function register_block_core_site_description() { | ||
register_block_type( | ||
'core/site-description', | ||
array( | ||
'attributes' => array( | ||
'className' => array( | ||
'type' => 'string', | ||
'default' => '', | ||
), | ||
'align' => array( | ||
'type' => 'string', | ||
), | ||
'textAlign' => array( | ||
'type' => 'string', | ||
'default' => 'center', | ||
), | ||
'textColor' => array( | ||
'type' => 'string', | ||
), | ||
'customTextColor' => array( | ||
'type' => 'string', | ||
), | ||
'backgroundColor' => array( | ||
'type' => 'string', | ||
), | ||
'customBackgroundColor' => array( | ||
'type' => 'string', | ||
), | ||
'fontSize' => array( | ||
'type' => 'string', | ||
), | ||
'customFontSize' => array( | ||
'type' => 'number', | ||
), | ||
), | ||
'render_callback' => 'render_block_core_site_description', | ||
) | ||
); | ||
} | ||
add_action( 'init', 'register_block_core_site_description' ); |