From b1d42dadd8a57e3f50c7d8c85328036eac7b40bc Mon Sep 17 00:00:00 2001 From: Stefan Kalscheuer Date: Sun, 24 Mar 2024 13:27:51 +0100 Subject: [PATCH] remove redundante test for has_block as we require WP 5.0 now --- includes/class-scliveticker.php | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/includes/class-scliveticker.php b/includes/class-scliveticker.php index c24dfaa..14eded2 100644 --- a/includes/class-scliveticker.php +++ b/includes/class-scliveticker.php @@ -261,7 +261,7 @@ class SCLiveticker { */ public static function enqueue_resources(): void { // Only add if shortcode is present. - if ( self::$shortcode_present || self::$widget_present || self::block_present() ) { + if ( self::$shortcode_present || self::$widget_present || has_block( 'scliveticker/ticker' ) ) { wp_enqueue_script( 'scliveticker-js', SCLIVETICKER_BASE . 'scripts/liveticker.min.js', @@ -473,15 +473,4 @@ class SCLiveticker { . '' . $title . '' . ''; } - - /** - * Check if the Gutenberg block is present in current post. - * - * @return boolean True, if Gutenberg block is present. - * @since 1.1 - */ - private static function block_present(): bool { - return function_exists( 'has_block' ) && // We are in WP 5.x environment. - has_block( 'scliveticker/ticker' ); // Specific block is present. - } }