Skip to content

Commit

Permalink
Load the slideshow block manually if needed.
Browse files Browse the repository at this point in the history
  • Loading branch information
jeherve committed Aug 6, 2024
1 parent 931449b commit 1f9c526
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion projects/plugins/jetpack/modules/shortcodes/slideshow.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,6 @@ public function shortcode_callback( $attr ) {
if (
class_exists( 'Jetpack_AMP_Support' )
&& Jetpack_AMP_Support::is_amp_request()
&& class_exists( 'Automattic\Jetpack\Extensions\Slideshow' )
) {
// Load the styles and use the rendering method from the Slideshow block.
Jetpack_Gutenberg::load_styles_as_required( 'slideshow' );
Expand All @@ -199,6 +198,14 @@ class_exists( 'Jetpack_AMP_Support' )
$amp_args['autoplay'] = true;
}

/*
* Blocks can be disabled in Jetpack Settings.
* If that's the case, we need to include the slideshow block manually.
*/
if ( ! class_exists( 'Automattic\Jetpack\Extensions\Slideshow' ) ) {
require_once JETPACK__PLUGIN_DIR . 'extensions/blocks/slideshow/slideshow.php';
}

return Slideshow\render_amp( $amp_args );
}

Expand Down

0 comments on commit 1f9c526

Please sign in to comment.