Themes: Introduce responsive embeds support.
Responsive embeds is a way for a theme to opt in to WordPress dynamically scaling the width/height of an embed. When a theme supports responsive embeds, a `wp-embed-responsive` class is added to the `<body>` tag. This information is also presented through the REST API for clients to respect. Merges [43790] and [43791] from the 5.0 branch to trunk. Props desrosj, danielbachhuber, ocean90. Fixes #45125. Built from https://develop.svn.wordpress.org/trunk@44138 git-svn-id: http://core.svn.wordpress.org/trunk@43968 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
5e1e612528
commit
c339798b49
|
@ -760,6 +760,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 ) {
|
||||
|
|
|
@ -112,6 +112,7 @@ class WP_REST_Themes_Controller extends WP_REST_Controller {
|
|||
$data['theme_supports']['formats'] = $formats;
|
||||
|
||||
$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 ) {
|
||||
|
@ -166,6 +167,11 @@ class WP_REST_Themes_Controller extends WP_REST_Controller {
|
|||
'type' => array( 'array', 'bool' ),
|
||||
'readonly' => true,
|
||||
),
|
||||
'responsive-embeds' => array(
|
||||
'description' => __( 'Whether the theme supports responsive embedded content.' ),
|
||||
'type' => 'bool',
|
||||
'readonly' => true,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
|
@ -2318,12 +2318,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.
|
||||
*/
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.1-alpha-44137';
|
||||
$wp_version = '5.1-alpha-44138';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue