Skip to content

Commit 98d3236

Browse files
committed
feat: add filter for Scroll to Top display
1 parent 2ffa67b commit 98d3236

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
@@ -712,20 +712,26 @@ public function sanitize_scroll_to_top_side( $value ) {
712712
*/
713713
public static function is_enabled() {
714714
// Check old option first for backward compatibility.
715-
$old_value = get_option( 'nv_pro_scroll_to_top_status', null );
715+
$old_value = get_option( 'nv_pro_scroll_to_top_status', null );
716+
$is_enabled = false;
716717

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

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

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

731737
/**

0 commit comments

Comments
 (0)