Nice idea. Could be very usable plugin, but has several errors, so functionality is broken. (WordPress 6.7.1, Block editor, theme ‘2024’).
Is ‘classic’ option and wp < 5.8 creating more ‘incompatibilities’ than compatibilities? ??
]]>Hey there;
I was getting a deprecation notice in the file class-begs-init.php. This is easily fixed by adding one line here:
<?php
namespace BEGS\Block_Editor_Gallery_Slider;
! defined( ABSPATH ) || exit;
if ( ! class_exists( 'BEGS_Init' ) ) {
class BEGS_Init extends Block_Editor_Gallery_Slider {
public $opt; // <-- this line added
Also, your plugin assumes that the global $post exists. If it doesn’t exist, it breaks with a javascript error that says “begs_options” doesn’t exist. This is fixed in the file class-begs-gallery-slider.php
There’s a lot of ways to fix this, mine might not be the best way, but here’s my solution:
public function localize_front_control_options() {
global $post;
$post_classic_meta = array(
'is_gallery_slider_enabled' => 0,
'container_class_name' => '',
);
$post_classic_meta = false;
if (is_object($post)) {
if ( get_post_meta( $post->ID, 'begs_classic_gallery_slider_options' ) ) {
$post_classic_meta = get_post_meta( $post->ID, 'begs_classic_gallery_slider_options' )[0];
}
}
if ( get_option( 'begs_disable_all_galleries' ) ) {
$option_disable_all_galleries = get_option( 'begs_disable_all_galleries' )['selected'];
} else {
$option_disable_all_galleries = false;
}
wp_localize_script(
'block-editor-gallery-slider-front',
'begs_options',
array(
'option_disable_all_galleries' => $option_disable_all_galleries,
'post_classic_gallery_slider_enabled' => !empty($post_classic_meta) ? $post_classic_meta['is_gallery_slider_enabled'] : false,
'post_classic_gallery_slider_container_wrap_class' => !empty($post_classic_meta) ? $post_classic_meta['container_class_name'] : 'slider-not-enabled',
)
);
}
It would be great if these fixes could make it into the code. I’m not really sure the procedure to do so and my desire to remember how to use SVN is low, so I’ll leave those details to someone who’s already done it if that’s okay ?? Thanks for making the plugin, it has (largely) worked very well for me!
]]>Hi! I am trying to use your plugin, but with wordpress 6 and the classic editor enabled I can’t find in my projects and posts the option to activate the slider. Can you help me? thanks
]]>