Smooth scroll offset filter

The GP Premium 2.4.0 update now includes a new filter to offset the height of the smooth scroll destination. This is useful for when you have smooth scroll activated from the Customizer settings and you have hash links set up to scroll smoothly to a certain block on the same page. More information here.

Sometimes, you would want to offset the scroll a few pixels in order to have certain elements visible after the scroll occurs. Here is an example code:

add_filter( 'generate_smooth_scroll_offset', function() {
    return 60; // 60px
} );

The above code would offset the scrolling destination position by 60px, meaning that the scroll would stop 60px above the destination element. The filter also accepts negative values.