Activate Back to top button for selected pages

There might be cases where you want the Back to top button to appear only on selected pages. As all of the Customizer options in GeneratePress are filterable, it’s very easy to do!

First you need to deactivate the Back to top button from the Customizer. Then, enter the following PHP code in your functions.php of a functionality plugin.

add_filter( 'option_generate_settings','gm_remove_back_to_top' );
function gm_remove_back_to_top ( $options ) {
    if ( is_page( 1259 ) ) {
        $options['back_to_top'] = 'enable';
    }

    return $options;
}

The above code enables the Back to top button for a page with ID 1259. You can take it from there!