edit interface failing with out of memory error
-
Where a slider is added to a page in WordPress 6.6.2 and the following options are selected design=’design-2′ through ‘design-5’ and the show_contents option is unset or set to ‘true’ once the page has been saved, on attempting to access the edit interface for that page (using the gutenberg editor) there is a fatal error
PHP message: PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 16384 bytes) in /var/www/html/wp-content/plugins/wp-slick-slider-and-image-carousel/includes/shortcodes/wpsisac-slider.php on line 112
on investigation this error can be resolved by using
<?php echo get_the_content() ?>
rather than<?php the_content() ?>
in the affected templates (see patch file below)diff --git a/templates/slider/design-2.php b/templates/slider/design-2.php
index 9565a37..74403ae 100644
--- a/templates/slider/design-2.php
+++ b/templates/slider/design-2.php
@@ -1 +1 @@
-<?php
/**
* Template for Carousel - Design 2
*
* @package WP Slick Slider and Image Carousel
* @since 1.0.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
?>
<div class="wpsisac-image-slide">
<div class="wpsisac-slide-wrap" style="<?php echo esc_attr( $slider_height_css ); ?>">
<img <?php if( $lazyload ) { ?>data-lazy="<?php echo esc_url( $slider_orig_img ); ?>"<?php } ?> src="<?php echo esc_url( $slider_img ); ?>" alt="<?php the_title_attribute(); ?>" />
<div class="wpsisac-slider-overlay">
<div class="wpsisac-slider-content">
<h2 class="wpsisac-slide-title"><?php the_title(); ?></h2>
<?php if( $show_content ) { ?>
<div class="wpsisac-slider-short-content"><?php the_content(); ?></div>
<?php }
if( $sliderurl != '' ) { ?>
<div class="wpsisac-readmore"><a href="<?php echo esc_url( $sliderurl ); ?>" class="wpsisac-slider-readmore"><?php esc_html_e( 'Read More', 'wp-slick-slider-and-image-carousel' ); ?></a></div>
<?php } ?>
</div>
</div>
</div>
</div>
\ No newline at end of file
+<?php
/**
* Template for Carousel - Design 2
*
* @package WP Slick Slider and Image Carousel
* @since 1.0.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
?>
<div class="wpsisac-image-slide">
<div class="wpsisac-slide-wrap" style="<?php echo esc_attr( $slider_height_css ); ?>">
<img <?php if( $lazyload ) { ?>data-lazy="<?php echo esc_url( $slider_orig_img ); ?>"<?php } ?> src="<?php echo esc_url( $slider_img ); ?>" alt="<?php the_title_attribute(); ?>" />
<div class="wpsisac-slider-overlay">
<div class="wpsisac-slider-content">
<h2 class="wpsisac-slide-title"><?php the_title(); ?></h2>
<?php if( $show_content ) { ?>
<div class="wpsisac-slider-short-content"><?php echo get_the_content(); ?></div>
<?php }
if( $sliderurl != '' ) { ?>
<div class="wpsisac-readmore"><a href="<?php echo esc_url( $sliderurl ); ?>" class="wpsisac-slider-readmore"><?php esc_html_e( 'Read More', 'wp-slick-slider-and-image-carousel' ); ?></a></div>
<?php } ?>
</div>
</div>
</div>
</div>
\ No newline at end of file
diff --git a/templates/slider/design-3.php b/templates/slider/design-3.php
index 0da0318..5eb036d 100644
--- a/templates/slider/design-3.php
+++ b/templates/slider/design-3.php
@@ -1 +1 @@
-<?php
/**
* Template for Carousel - Design 3
*
* @package WP Slick Slider and Image Carousel
* @since 1.0.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
?>
<div class="wpsisac-image-slide">
<div class="wpsisac-slide-wrap" style="<?php echo esc_attr( $slider_height_css ); ?>">
<img <?php if( $lazyload ) { ?>data-lazy="<?php echo esc_url( $slider_orig_img ); ?>"<?php } ?> src="<?php echo esc_url( $slider_img ); ?>" alt="<?php the_title_attribute(); ?>" />
<div class="wpsisac-slider-content">
<div class="wpsisac-bg-overlay wp-medium-7 wpcolumns">
<h2 class="wpsisac-slide-title"><?php the_title(); ?></h2>
<?php if( $show_content ) { ?>
<div class="wpsisac-slider-short-content"><?php the_content(); ?></div>
<?php }
if( $sliderurl != '' ) { ?>
<div class="wpsisac-readmore"><a href="<?php echo esc_url( $sliderurl ); ?>" class="wpsisac-slider-readmore"><?php esc_html_e( 'Read More', 'wp-slick-slider-and-image-carousel' ); ?></a></div>
<?php } ?>
</div>
</div>
</div>
</div>
\ No newline at end of file
+<?php
/**
* Template for Carousel - Design 3
*
* @package WP Slick Slider and Image Carousel
* @since 1.0.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
?>
<div class="wpsisac-image-slide">
<div class="wpsisac-slide-wrap" style="<?php echo esc_attr( $slider_height_css ); ?>">
<img <?php if( $lazyload ) { ?>data-lazy="<?php echo esc_url( $slider_orig_img ); ?>"<?php } ?> src="<?php echo esc_url( $slider_img ); ?>" alt="<?php the_title_attribute(); ?>" />
<div class="wpsisac-slider-content">
<div class="wpsisac-bg-overlay wp-medium-7 wpcolumns">
<h2 class="wpsisac-slide-title"><?php the_title(); ?></h2>
<?php if( $show_content ) { ?>
<div class="wpsisac-slider-short-content"><?php echo get_the_content(); ?></div>
<?php }
if( $sliderurl != '' ) { ?>
<div class="wpsisac-readmore"><a href="<?php echo esc_url( $sliderurl ); ?>" class="wpsisac-slider-readmore"><?php esc_html_e( 'Read More', 'wp-slick-slider-and-image-carousel' ); ?></a></div>
<?php } ?>
</div>
</div>
</div>
</div>
\ No newline at end of file
diff --git a/templates/slider/design-4.php b/templates/slider/design-4.php
index 940333a..08cc112 100644
--- a/templates/slider/design-4.php
+++ b/templates/slider/design-4.php
@@ -1 +1 @@
-<?php
/**
* Template for Carousel - Design 4
*
* @package WP Slick Slider and Image Carousel
* @since 1.0.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
?>
<div class="wpsisac-image-slide">
<div class="wpsisac-slide-wrap wp-medium-12 wpcolumns">
<div class="wpsisac-content-left wp-medium-7 wpcolumns">
<h2 class="wpsisac-slide-title"><?php the_title(); ?></h2>
<?php if( $show_content ) { ?>
<div class="wpsisac-slider-short-content"><?php the_content(); ?></div>
<?php }
if( $sliderurl != '' ) { ?>
<div class="wpsisac-readmore"><a href="<?php echo esc_url( $sliderurl ); ?>" class="wpsisac-slider-readmore"><?php esc_html_e( 'Read More', 'wp-slick-slider-and-image-carousel' ); ?></a></div>
<?php } ?>
</div>
<div class="wpsisac-content-right wp-medium-5 wpcolumns">
<img <?php if( $lazyload ) { ?>data-lazy="<?php echo esc_url( $slider_orig_img ); ?>"<?php } ?> src="<?php echo esc_url( $slider_img ); ?>" alt="<?php the_title_attribute(); ?>" />
</div>
</div>
</div>
\ No newline at end of file
+<?php
/**
* Template for Carousel - Design 4
*
* @package WP Slick Slider and Image Carousel
* @since 1.0.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
?>
<div class="wpsisac-image-slide">
<div class="wpsisac-slide-wrap wp-medium-12 wpcolumns">
<div class="wpsisac-content-left wp-medium-7 wpcolumns">
<h2 class="wpsisac-slide-title"><?php the_title(); ?></h2>
<?php if( $show_content ) { ?>
<div class="wpsisac-slider-short-content"><?php echo get_the_content(); ?></div>
<?php }
if( $sliderurl != '' ) { ?>
<div class="wpsisac-readmore"><a href="<?php echo esc_url( $sliderurl ); ?>" class="wpsisac-slider-readmore"><?php esc_html_e( 'Read More', 'wp-slick-slider-and-image-carousel' ); ?></a></div>
<?php } ?>
</div>
<div class="wpsisac-content-right wp-medium-5 wpcolumns">
<img <?php if( $lazyload ) { ?>data-lazy="<?php echo esc_url( $slider_orig_img ); ?>"<?php } ?> src="<?php echo esc_url( $slider_img ); ?>" alt="<?php the_title_attribute(); ?>" />
</div>
</div>
</div>
\ No newline at end of file
diff --git a/templates/slider/design-5.php b/templates/slider/design-5.php
index 6eb0a7e..81940ed 100644
--- a/templates/slider/design-5.php
+++ b/templates/slider/design-5.php
@@ -1 +1 @@
-<?php
/**
* Template for Slider - Design 5
*
* @package WP Slick Slider and Image Carousel
* @since 1.0.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
?>
<div class="wpsisac-image-slide">
<div class="wpsisac-slide-wrap">
<div class="wpsisac-slider-content">
<h2 class="wpsisac-slide-title"><?php the_title(); ?></h2>
<?php if( $show_content ) { ?>
<div class="wpsisac-slider-short-content"><?php the_content(); ?></div>
<?php }
if( $sliderurl != '' ) { ?>
<div class="wpsisac-readmore"><a href="<?php echo esc_url( $sliderurl ); ?>" class="wpsisac-slider-readmore"><?php esc_html_e( 'Read More', 'wp-slick-slider-and-image-carousel' ); ?></a></div>
<?php } ?>
</div>
</div>
</div>
\ No newline at end of file
+<?php
/**
* Template for Slider - Design 5
*
* @package WP Slick Slider and Image Carousel
* @since 1.0.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
?>
<div class="wpsisac-image-slide">
<div class="wpsisac-slide-wrap">
<div class="wpsisac-slider-content">
<h2 class="wpsisac-slide-title"><?php the_title(); ?></h2>
<?php if( $show_content ) { ?>
<div class="wpsisac-slider-short-content"><?php echo get_the_content(); ?></div>
<?php }
if( $sliderurl != '' ) { ?>
<div class="wpsisac-readmore"><a href="<?php echo esc_url( $sliderurl ); ?>" class="wpsisac-slider-readmore"><?php esc_html_e( 'Read More', 'wp-slick-slider-and-image-carousel' ); ?></a></div>
<?php } ?>
</div>
</div>
</div>
\ No newline at end of file
- You must be logged in to reply to this topic.