Site logo

Archived topic

Back to Top on one page only

3 replies · Started by Ramona on October 9, 2020

Viewing posts 1–4 of 4

I am using GP and GPP. Prior to the Update to GP version 3.0.1, I was able to successfully run the following in my functions.php of my Child Theme in order to have Back To Top functionality on one page only. In the Customizer > Layout > Footer, Back To Top Button was Disabled. What has changed?

Code:
function ramona_add_back_to_top($options ) {
if ( is_page( 'gallery' ) ) {
$options['back_to_top'] = 'enable';
}

return $options;
}

add_filter( 'option_generate_settings','ramona_add_back_to_top' );

Hi there,

GP 3.0 only loads the back to top CSS if it's enabled globally.

You could try doing something like this:

1. Enable the option globally.
2. Disable it everywhere but the page:

add_filter( 'option_generate_settings', function( $options ) {
    if ( ! is_page( 'gallery' ) ) {
        $options['back_to_top'] = '';
    }

    return $options;
} );

Let me know :)

Hi Tom,

Thank You SO MUCH! It worked like a charm. Thank You for all of your hard work. It's much appreciated!

Awesome, glad I could help! :)

This archived topic is closed to new replies.