Skip to content

Commit ccc8053

Browse files
feat: add filter for Scroll to Top display (#4449)
1 parent a82b6cf commit ccc8053

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

inc/customizer/options/scroll_to_top.php

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -711,20 +711,26 @@ public function sanitize_scroll_to_top_side( $value ) {
711711
*/
712712
public static function is_enabled() {
713713
// Check old option first for backward compatibility.
714-
$old_value = get_option( 'nv_pro_scroll_to_top_status', null );
714+
$old_value = get_option( 'nv_pro_scroll_to_top_status', null );
715+
$is_enabled = false;
715716

716717
if ( null !== $old_value ) {
717718
// Option exists — use it and migrate to the new theme_mod for future.
718-
$value = $old_value === '1';
719+
$is_enabled = $old_value === '1';
719720

720721
set_theme_mod( 'neve_scroll_to_top_status', $old_value );
721722
delete_option( 'nv_pro_scroll_to_top_status' );
722-
723-
return $value;
723+
} else {
724+
// Otherwise, use the new theme_mod.
725+
$is_enabled = get_theme_mod( 'neve_scroll_to_top_status', '1' ) === '1';
724726
}
725727

726-
// Otherwise, use the new theme_mod.
727-
return get_theme_mod( 'neve_scroll_to_top_status', '1' ) === '1';
728+
/**
729+
* Filter to allow conditional loading of the scroll to top feature.
730+
*
731+
* @param bool $is_enabled Whether the scroll to top feature is enabled.
732+
*/
733+
return apply_filters( 'neve_scroll_to_top_is_enabled', $is_enabled );
728734
}
729735

730736
/**

0 commit comments

Comments
 (0)