jkaljundi
Forum Replies Created
-
Forum: Plugins
In reply to: [WP Swiper] error: Cannot redeclare has_wp_swiper_block()Yes we have 1.2.11:
WP Swiper
Swiper JS as a Gutenberg Block.Version 1.2.11 | By Digital Apps | View details
Disable auto-updatesForum: Plugins
In reply to: [WP Swiper] error: Cannot redeclare has_wp_swiper_block()Sorry a bit further down:
// Check if the current post contains the Swiper Gutenberg block and the option is enabled125if (true=== $load_swiper) {126 $this->loadWpSwiper();127 } else {128if (function_exists(‘register_block_type’)) {129if (130!$load_swiper &&131 $this->block_detector->contains_wp_swiper_block($post)132 ) {133 $this->loadWpSwiper();134 }135 }136 }137 }
Anyway, this discussion is useless. We commented out the double include that the update causes and it works now. If you want, you can revert back to your old working code as well. No need to argue ??
Forum: Plugins
In reply to: [WP Swiper] error: Cannot redeclare has_wp_swiper_block()Yes, exactly the same file. Line 120 condition check causes the problems with redeclare error. If we comment it out so there is no double declare it works.
Forum: Plugins
In reply to: [WP Swiper] error: Cannot redeclare has_wp_swiper_block()Version 1.2.9
Yes, same file.
I think the changes you did in 1.2.9 for block detection are what causes the recursion:
== Changelog == 83= 1.2.9 = 84* Improve swiper block detection within content. Applicable for conditional bundle loading. 85
Forum: Plugins
In reply to: [WP Swiper] error: Cannot redeclare has_wp_swiper_block()I think your code does a duplicate include.
if (!function_exists('has_wp_swiper_block'))
????????????????{
????????????????function has_wp_swiper_block($blocks)
and
/**
?????????* Function to check if a post contains a 'da/wp-swiper-slides' block.
?????????* This function handles reusable blocks (core/block) and standard blocks.
?????????*
?????????* @param WP_Post $post The post object to check.
?????????* @return bool Returns true if the 'da/wp-swiper-slides' block is found, false otherwise.
?????????*/
????????function contains_wp_swiper_block($post)
????????{
????????????????if (!isset($post->post_content)) {
????????????????????????return false; // No content to parse.
????????????????}
????????????????// Parse the blocks in the post content
????????????????$blocks = parse_blocks($post->post_content);
????????????????// Recursively search for the 'da/wp-swiper-slides' block in parsed blocks
????????????????if (!function_exists('has_wp_swiper_block'))
????????????????{
????????????????function has_wp_swiper_block($blocks)
????????????????{so the function include double defines.