该插件尚未通过WordPress的最新3个主要版本进行测试。 当与较新版本的WordPress一起使用时,可能不再受到维护或支持,并且可能会存在兼容性问题。

Responsive oEmbed

描述

ATTENTION for WP Version 5+: This plugin does not work with Gutenberg (no problems with Classic Editor plugin though)! Gutenberg brings its own CSS for responsive oEmbed elements, so this plugin would double that and create strange effects.

This plugin uses some minimal CSS rules and a wrapping HTML element to maintain the aspect ratio of oEmbed elements with fixed aspect ratio (e. g. YouTube, Vimeo or Soundcloud).

Unlike other plugins, this plugin does not use any JavaScript!

The aspect ratio is calculated from the (iframe, object or embed) HTML tag width and height attributes. An aspect ratio will only be applied, if both width AND height attributes are given by the oEmbed element and if there is no data-secret attribut set (because those are handled via wp-embed.js). Some oEmbeds have no width or height attributes set, because they calculate their dimension via JavaScript. In those cases this plugin has no effect.

You can find a list of all oEmbed sites supported by WordPress here.

安装

  1. Upload responsive-oembed.zip to the /wp-content/plugins/ directory.
  2. Activate the plugin through the ‘Plugins’ menu in WordPress.
  3. You’re done! Try pasting a YouTube, Vimeo or any other oEmbed URL into a post. Open the post and resize your browser window, the oEmbed element should scale properly.

评价

2019年4月30日
I followed the minimal instructions but the plugin did nothing. My embedded content was still NOT responsive.
2018年1月5日
It works perfect! I had purchased a minimalist theme (those built for being fast) but it had an issue with oembed videos. This plugin saved my life! Thanks.
阅读所有3条评价

贡献者及开发者

“Responsive oEmbed” 是开源软件。 以下人员对此插件做出了贡献。

贡献者

将“Responsive oEmbed”翻译成您的语言。

对开发感兴趣吗?

您可以浏览代码,查看SVN仓库,或通过RSS订阅开发日志

更新日志

1.4.1

  • WordPress 5.1 compatibility check and readme.txt update.

1.4

  • Exclude WordPress post embeds, because their size is handled via wp-embed.js.

1.3

  • Fixed problem with unexpected margins in frontend and backend.

1.2

  • Changed wrapper HTML tag to div to prevent parsing errors, when there are blockquotes or other p tags inside the oembed code.

1.1

  • Allow any aspect ratios.

1.0

  • First release