Skip to content

Commit

Permalink
Skip adding data attributes for gallery shortcodes
Browse files Browse the repository at this point in the history
  • Loading branch information
westonruter committed Jul 24, 2020
1 parent 9745353 commit 6eb20db
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions includes/embeds/class-amp-core-block-handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,17 @@ public function unregister_embed() {
* @return string Filtered block content.
*/
public function filter_rendered_block( $block_content, $block ) {
if ( ! isset( $block['blockName'] ) ) {
return $block_content;
}

if ( isset( $block['attrs'] ) ) {
if ( isset( $block['attrs'] ) && 'core/shortcode' !== $block['blockName'] ) {
$injected_attributes = '';
$prop_attribute_mapping = [
'ampCarousel' => 'data-amp-carousel',
'ampLayout' => 'data-amp-layout',
'ampNoLoading' => 'data-amp-noloading',
'ampLightbox' => 'data-amp-lightbox',
'ampCarousel' => 'data-amp-carousel',
'ampNoLoading' => 'data-amp-noloading',
];
foreach ( $prop_attribute_mapping as $prop => $attr ) {
if ( isset( $block['attrs'][ $prop ] ) ) {
Expand All @@ -100,9 +103,6 @@ public function filter_rendered_block( $block_content, $block ) {
}
}

if ( ! isset( $block['blockName'] ) ) {
return $block_content;
}
if ( isset( $this->block_ampify_methods[ $block['blockName'] ] ) ) {
$method_name = $this->block_ampify_methods[ $block['blockName'] ];
$block_content = $this->{$method_name}( $block_content, $block );
Expand Down

0 comments on commit 6eb20db

Please sign in to comment.