Skip to content

Commit

Permalink
Add AMP support.
Browse files Browse the repository at this point in the history
  • Loading branch information
pento authored and Glen Davies committed Feb 4, 2020
1 parent 57c6d55 commit 53e9df9
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion extensions/blocks/google-calendar/google-calendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,17 @@
* @return string
*/
function jetpack_google_calendar_block_load_assets( $attr ) {
return <<<EOT
if ( class_exists( 'Jetpack_AMP_Support' ) && Jetpack_AMP_Support::is_amp_request() ) {
return <<<EOT
<div class="wp-block-jetpack-google-calendar">
<amp-iframe src="${attr['url']}" frameborder="0" style="border:0" scrolling="no" width="${attr['width']}" height="${attr['height']}" sandbox="allow-scripts allow-same-origin" layout="responsive"></amp-iframe>
</div>
EOT;
} else {
return <<<EOT
<div class="wp-block-jetpack-google-calendar">
<iframe src="${attr['url']}" frameborder="0" style="border:0" scrolling="no" width="${attr['width']}" height="${attr['height']}"></iframe>
</div>
EOT;
}
}

0 comments on commit 53e9df9

Please sign in to comment.