diff --git a/wp-includes/blocks/categories.php b/wp-includes/blocks/categories.php index bd1175733b..83bf1c9db2 100644 --- a/wp-includes/blocks/categories.php +++ b/wp-includes/blocks/categories.php @@ -16,11 +16,6 @@ function render_block_core_categories( $attributes ) { static $block_id = 0; $block_id++; - $align = 'center'; - if ( isset( $attributes['align'] ) && in_array( $attributes['align'], array( 'left', 'right', 'full' ), true ) ) { - $align = $attributes['align']; - } - $args = array( 'echo' => false, 'hierarchical' => ! empty( $attributes['showHierarchy'] ), @@ -46,10 +41,14 @@ function render_block_core_categories( $attributes ) { $type = 'list'; } - $class = "wp-block-categories wp-block-categories-{$type} align{$align}"; + $class = "wp-block-categories wp-block-categories-{$type}"; + + if ( isset( $attributes['align'] ) ) { + $class .= " align{$attributes['align']}"; + } if ( isset( $attributes['className'] ) ) { - $class .= ' ' . $attributes['className']; + $class .= " {$attributes['className']}"; } $block_content = sprintf( diff --git a/wp-includes/blocks/latest-comments.php b/wp-includes/blocks/latest-comments.php index dd310028ce..199a426a93 100644 --- a/wp-includes/blocks/latest-comments.php +++ b/wp-includes/blocks/latest-comments.php @@ -5,32 +5,34 @@ * @package gutenberg */ -/** - * Get the post title. - * - * The post title is fetched and if it is blank then a default string is - * returned. - * - * Copied from `wp-admin/includes/template.php`, but we can't include that - * file because: - * - * 1. It causes bugs with test fixture generation and strange Docker 255 error - * codes. - * 2. It's in the admin; ideally we *shouldn't* be including files from the - * admin for a block's output. It's a very small/simple function as well, - * so duplicating it isn't too terrible. - * - * @since 3.3.0 - * - * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post. - * @return string The post title if set; "(no title)" if no title is set. - */ -function gutenberg_draft_or_post_title( $post = 0 ) { - $title = get_the_title( $post ); - if ( empty( $title ) ) { - $title = __( '(no title)', 'gutenberg' ); +if ( ! function_exists( 'gutenberg_draft_or_post_title' ) ) { + /** + * Get the post title. + * + * The post title is fetched and if it is blank then a default string is + * returned. + * + * Copied from `wp-admin/includes/template.php`, but we can't include that + * file because: + * + * 1. It causes bugs with test fixture generation and strange Docker 255 error + * codes. + * 2. It's in the admin; ideally we *shouldn't* be including files from the + * admin for a block's output. It's a very small/simple function as well, + * so duplicating it isn't too terrible. + * + * @since 3.3.0 + * + * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post. + * @return string The post title if set; "(no title)" if no title is set. + */ + function gutenberg_draft_or_post_title( $post = 0 ) { + $title = get_the_title( $post ); + if ( empty( $title ) ) { + $title = __( '(no title)', 'gutenberg' ); + } + return esc_html( $title ); } - return esc_html( $title ); } /** diff --git a/wp-includes/post-template.php b/wp-includes/post-template.php index b80ac4d4e4..9ff1d08ea4 100644 --- a/wp-includes/post-template.php +++ b/wp-includes/post-template.php @@ -722,6 +722,10 @@ function get_body_class( $class = '' ) { $classes[] = 'wp-custom-logo'; } + if ( current_theme_supports( 'responsive-embeds' ) ) { + $classes[] = 'wp-embed-responsive'; + } + $page = $wp_query->get( 'page' ); if ( ! $page || $page < 2 ) diff --git a/wp-includes/rest-api/endpoints/class-wp-rest-themes-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-themes-controller.php index 4aa7db4f6f..4c958f8f67 100644 --- a/wp-includes/rest-api/endpoints/class-wp-rest-themes-controller.php +++ b/wp-includes/rest-api/endpoints/class-wp-rest-themes-controller.php @@ -111,8 +111,9 @@ class WP_REST_Themes_Controller extends WP_REST_Controller { $formats = array_merge( array( 'standard' ), $formats ); $data['theme_supports']['formats'] = $formats; - $data['theme_supports']['post-thumbnails'] = false; - $post_thumbnails = get_theme_support( 'post-thumbnails' ); + $data['theme_supports']['post-thumbnails'] = false; + $data['theme_supports']['responsive-embeds'] = (bool) get_theme_support( 'responsive-embeds' ); + $post_thumbnails = get_theme_support( 'post-thumbnails' ); if ( $post_thumbnails ) { // $post_thumbnails can contain a nested array of post types. @@ -156,16 +157,21 @@ class WP_REST_Themes_Controller extends WP_REST_Controller { 'type' => 'array', 'readonly' => true, 'properties' => array( - 'formats' => array( + 'formats' => array( 'description' => __( 'Post formats supported.' ), 'type' => 'array', 'readonly' => true, ), - 'post-thumbnails' => array( + 'post-thumbnails' => array( 'description' => __( 'Whether the theme supports post thumbnails.' ), 'type' => array( 'array', 'bool' ), 'readonly' => true, ), + 'responsive-embeds' => array( + 'description' => __( 'Whether the theme supports responsive embedded content.', 'gutenberg' ), + 'type' => 'bool', + 'readonly' => true, + ), ), ), ), diff --git a/wp-includes/theme.php b/wp-includes/theme.php index 947226c4d4..3a7a9e871d 100644 --- a/wp-includes/theme.php +++ b/wp-includes/theme.php @@ -2210,12 +2210,14 @@ function get_theme_starter_content() { * @since 4.1.0 The `title-tag` feature was added * @since 4.5.0 The `customize-selective-refresh-widgets` feature was added * @since 4.7.0 The `starter-content` feature was added + * @since 5.0.0 The `responsive-embeds` feature was added. * * @global array $_wp_theme_features * * @param string $feature The feature being added. Likely core values include 'post-formats', * 'post-thumbnails', 'html5', 'custom-logo', 'custom-header-uploads', - * 'custom-header', 'custom-background', 'title-tag', 'starter-content', etc. + * 'custom-header', 'custom-background', 'title-tag', 'starter-content', + * 'responsive-embeds/', etc. * @param mixed $args,... Optional extra arguments to pass along with certain features. * @return void|bool False on failure, void otherwise. */ diff --git a/wp-includes/version.php b/wp-includes/version.php index bf85ac755b..d5c6edee29 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '5.0-alpha-43789'; +$wp_version = '5.0-alpha-43790'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.