get_oembed_response_data_rich
函数
get_oembed_response_data_rich ( $data, $post, $width, $height )
- 参数
-
-
(array)
$data
The response data.- Required: 是
-
(WP_Post)
$post
The post object.- Required: 是
-
(int)
$width
The requested width.- Required: 是
-
(int)
$height
The calculated height.- Required: 是
-
(array)
- 返回值
-
- (array) The modified response data.
- 定义位置
-
-
wp-includes/embed.php
, line 698
-
wp-includes/embed.php
- 引入
- 4.4.0
- 弃用
- –
Filters the oEmbed response data to return an iframe embed code.
function get_oembed_response_data_rich( $data, $post, $width, $height ) { $data['width'] = absint( $width ); $data['height'] = absint( $height ); $data['type'] = 'rich'; $data['html'] = get_post_embed_html( $width, $height, $post ); // Add post thumbnail to response if available. $thumbnail_id = false; if ( has_post_thumbnail( $post->ID ) ) { $thumbnail_id = get_post_thumbnail_id( $post->ID ); } if ( 'attachment' === get_post_type( $post ) ) { if ( wp_attachment_is_image( $post ) ) { $thumbnail_id = $post->ID; } elseif ( wp_attachment_is( 'video', $post ) ) { $thumbnail_id = get_post_thumbnail_id( $post ); $data['type'] = 'video'; } } if ( $thumbnail_id ) { list( $thumbnail_url, $thumbnail_width, $thumbnail_height ) = wp_get_attachment_image_src( $thumbnail_id, array( $width, 99999 ) ); $data['thumbnail_url'] = $thumbnail_url; $data['thumbnail_width'] = $thumbnail_width; $data['thumbnail_height'] = $thumbnail_height; } return $data; }
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。