hello, I think you have a duplicate file somewhere. May be try deleting the folder with the plugin and reinstalling again.
has_wp_swiper_block() declared once, and should not be throwing an error about it being declared elsewhere.
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.
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
can you please click on this link and inspect the source
https://plugins.trac.wordpress.org/browser/wp-swiper/trunk/public/class-wp-swiper-public.php
Compare to what you have, above link is the source code that you should use.
You can manually copy paste over your file. Or delete and reinstall the swiper. Im not sure why you have a double declaration.
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.
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 🙂
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-updates
we are not arguing, but I think you have a problem in your code. I suggest searching your whole wp-content folder for the function name, i think you are using the same function name twice.
i dont have this issue, noone else reported this issue. i dont see a point to revert to anywhere since nothing appears to be broken on my end. let me know how you go.