remove redundante test for has_block as we require WP 5.0 now

This commit is contained in:
Stefan Kalscheuer 2024-03-24 13:27:51 +01:00
parent fc957fd3b4
commit b1d42dadd8
Signed by: stefan
GPG Key ID: 3887EC2A53B55430

View File

@ -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 {
. '<span class="sclt-widget-title">' . $title . '</span>'
. '</li>';
}
/**
* 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.
}
}