內容簡介
注意:WP 版本 5+:此外掛與古騰堡 (Gutenberg) 無法運作(使用傳統編輯器外掛則無問題)!古騰堡採用自己的 CSS 實現響應式 oEmbed 元素,因此此外掛會使其加倍並造成奇怪的效果。
此外掛使用一些最小化的 CSS 規則和包裝 HTML 元素來維持具有固定比例的 oEmbed 元素的長寬比 (例如 YouTube、Vimeo 或 Soundcloud)。
與其他外掛不同,此外掛不使用任何 JavaScript!
長寬比是從 (iframe、object 或 embed) HTML 標記的寬度和高度屬性計算而來。僅當 oEmbed 元素提供了寬度和高度屬性,而且未設置 data-secret 屬性(因為這些是通過 wp-embed.js 處理)時,才會應用長寬比。有些 oEmbed 沒有設置寬度或高度屬性,因為它們通過 JavaScript 計算其尺寸。在這些情況下,此外掛無效。
您可以在此處找到 WordPress 支持的所有 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.
