remove redundante test for has_block as we require WP 5.0 now
This commit is contained in:
parent
fc957fd3b4
commit
b1d42dadd8
@ -261,7 +261,7 @@ class SCLiveticker {
|
|||||||
*/
|
*/
|
||||||
public static function enqueue_resources(): void {
|
public static function enqueue_resources(): void {
|
||||||
// Only add if shortcode is present.
|
// 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(
|
wp_enqueue_script(
|
||||||
'scliveticker-js',
|
'scliveticker-js',
|
||||||
SCLIVETICKER_BASE . 'scripts/liveticker.min.js',
|
SCLIVETICKER_BASE . 'scripts/liveticker.min.js',
|
||||||
@ -473,15 +473,4 @@ class SCLiveticker {
|
|||||||
. '<span class="sclt-widget-title">' . $title . '</span>'
|
. '<span class="sclt-widget-title">' . $title . '</span>'
|
||||||
. '</li>';
|
. '</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.
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user