mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-10-06 07:36:58 +00:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@44138 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -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.' ),
|
||||
'type' => 'bool',
|
||||
'readonly' => true,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user