Conversation
2e7152b to
85f1946
Compare
| } elseif ( intval( $poll ) > 0 ) { //poll embed | ||
|
|
||
| if ( cs_is_amp_page() ) { | ||
| return sprintf( '<amp-iframe src="https://poll.fm/%d/embed" frameborder="0" height="400" layout="fixed-height" width="auto" sandbox="allow-scripts allow-same-origin" style="height: 400px; --loader-delay-offset:406ms !important;" i-amphtml-layout="fixed-height"></amp-iframe>', $poll ); |
There was a problem hiding this comment.
Looks like there is support for resizing... involves changes to the amp-iframe and the content it is loading.
https://amp.dev/documentation/examples/components/amp-iframe/#resizable-iframe
I'll give this a try and see how it works.
There was a problem hiding this comment.
@roundhill thanks for asking about this again. I was able to add support to the poll iframe.
Might be able to do the same with our surveys. Just want to get you to test it on polls to make sure I'm on the right track 😄
See testing instructions for the Crowdsignal side changes that are required.
Ah thanks for finding that! I was looking in the console but didn't notice anything, but maybe because its in an iframe theres a separate console (I feel like FF and Chrome expose those in different ways). I can take it from there. |
|
Form submission is now working, but the survey resize doesn't seem 100% reliable. Works well on a standard survey, but not working for the Start page... even though the js is executing (confirmed by putting in some console.log statements) but the amp-iframe seems to be ignoring the resize requests. |
|
abandoning since I'm no longer involved with this plugin |



This PR replaces poll js embed rendering with an amp-iframe when the page is being served via AMP.
Changes proposed in this Pull Request:
amp-iframeinstead of a poll js embed (markup taken from what WordPress renders by default, with some changes to support iframe resizing)Testing instructions:
The Official AMP plugin needs to be installed on your site (or test on WPCOM) OR
AMP for WP – Accelerated Mobile Pagesplugin/embedblock, or just in a new line on the page)[crowdsignal poll=10603231]/ampendpoint and the poll should render correctly (as an iframe)/ampendpoint and the poll should render correctly (as a js embed)Known issues
Proposed changelog entry for your changes: