A WordPress block and shortcode for embedding iframes that are responsive horizontally and vertically, using the NPR Visuals Team's Pym.js.
Pym.js Embeds provides shortcode and Gutenberg block wrappers for embedding responsive iframes using Pym.js, developed by the NPR Visuals Team. Embedded content resizes vertically to match its container’s width.
AMP compatibility is provided by the official AMP plugin.
You may also want to look at NPR’s Pym.js resources:
Pym.js
, and whether you’d like to prevent post authors from setting embed-specific URLs for Pym.js
For answers to frequently asked questions, see this plugin’s documentation on GitHub.
For support resources, see this plugin’s documentation on GitHub.
New features:
amp-iframe
tags. If you’re not using the AMP Plugin, your site won’t be affected. And if you’re not viewing a page on an AMP endpoint, the page won’t be affected. PR #62 by Claudiu Lodromanean, originally for Automattic’s Newspack.Other updates:
This is a major update! Please read the release notes.
Following the practice begun at plugin version 1.1.2 of having the plugin version number match the version number of the bundled copy of Pym.js
, the first three numbers in this plugin’s version do not change with this release because the Pym.js
version has not changed. We’ve tacked a .1
on to the end to denote this release. Please read the release notes and test your site as appropriate before upgrading in production.
We wish to thank all who helped us test the release candidate for this version, including Mike Janssen at Current.org and Alyson Hurt at the NPR Visuals Team.
New features:
manage_options
capability, with the following options: Pym.js
. This is to make the process of building new interactives easier.align=""
parameter, so that WordPress’s generated alignment CSS classes can be used on embeds. By enabling this in the shortcode, the Gutenberg Block also gains support for alignment. PR #34. Prior to this release, the alignment classes could be added via the class=""
parameter.the_content()
, instead being output during wp_footer()
by closures hooked on the 'wp_footer'
action. PR #34 for issues #33 and #35.new pym.Parent
is now configurable. By replacing the pluggable functionpym_shortcode_script_footer_enqueue()
with your own function, you can now use alternate forms of embed code that may be required for PJAX sites or custom versions of Pym.js. This resolves issue #19.readme.txt
, since we’re now using PHP namespaces for some code.Changes:
pymjs
, known as the pymsrc URL, is now passed through wp_http_validate_url. PR #45 for issue #8.pym.js
is no longer output by the_content()
, instead being output during wp_footer
by an action dedicated to the task. If different shortcodes and/or blocks on the page specify different source URLs for Pym.js, all are output (after removing duplicates), but a message is logged in the browser console. If WP_DEBUG
is set, this message is also logged to the server log, with the post ID specified. PR #34 for issues #33 and #35. See https://github.com/INN/pym-shortcode/tree/master/docs#ive-set-a-different-pymsrc-option-but-now-im-seeing-a-message-in-the-consoledocs/updating-pym.md
becomes docs/maintainer-notes.md
the_content()
, instead being output during wp_footer()
by closures hooked on the 'wp_footer'
action. PR #34 for issues #33 and #35.Removed:
the_content()
, instead being output during wp_footer()
by closures hooked on the 'wp_footer'
action. PR #34 for issues #33 and #35.id=""
attribute to allow setting custom IDs on embeds. #21class=""
attribute to allow setting custom classes on embeds. #22 and #23.pym
to all embed-containing div elements output by this plugin, and a filter ‘pym_shortcode_default_class’ to allow changing it.pymsrc
attribute might have been ignored, for real this time. Thanks, lchheng!Pym.js
in this plugin to js/pym.v1.min.js
, leaving the existing js/pym.js
where it is.Pym.js
in this pluginpymsrc
attribute might have been ignored