From 8834b9a4a47e96ace06555359f8f733ae01db572 Mon Sep 17 00:00:00 2001 From: Copons Date: Thu, 26 Sep 2019 10:29:06 +0200 Subject: [PATCH] On WPCOM use the WPCOM responsive images handlers --- .../full-site-editing/templates/class-wp-template.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/apps/full-site-editing/full-site-editing-plugin/full-site-editing/templates/class-wp-template.php b/apps/full-site-editing/full-site-editing-plugin/full-site-editing/templates/class-wp-template.php index c466cb446a63c..55c705ad58ec4 100644 --- a/apps/full-site-editing/full-site-editing-plugin/full-site-editing/templates/class-wp-template.php +++ b/apps/full-site-editing/full-site-editing-plugin/full-site-editing/templates/class-wp-template.php @@ -203,12 +203,18 @@ public function output_template_content( $template_type ) { // 10 priority $content = wptexturize( $content ); - // @todo maybe look at WPCOM_Responsive_Images for WPCom responsive image handling + // 11 priority $content = do_shortcode( $content ); $content = prepend_attachment( $content ); - $content = wp_make_content_images_responsive( $content ); + + if ( defined( 'IS_WPCOM' ) && IS_WPCOM && class_exists( '\WPCOM_Responsive_Images' ) ) { + $wpcom_responsive_images_instance = new \WPCOM_Responsive_Images(); + $content = $wpcom_responsive_images_instance->make_content_images_responsive( $content ); + } else { + $content = wp_make_content_images_responsive( $content ); + } // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped echo $content;