Site logo

Archived topic

Disable back to top button on all pages except one

3 replies · Started by Sam on March 4, 2021

Viewing posts 1–4 of 4

Hi Sam,

If your blog page is the also the front page, then try this PHP snippet:

add_filter( 'option_generate_settings', function( $settings ) {
    if ( is_front_page() && is_home() ) {
        $settings['back_to_top'] = '';
    }

    return $settings;
} );

If you are using a static home page with a separate blog page then try this:

add_filter( 'option_generate_settings', function( $settings ) {
    if ( is_home() ) {
        $settings['back_to_top'] = '';
    }

    return $settings;
} );

Adding PHP: https://docs.generatepress.com/article/adding-php/

Let me know if this helps :)

Thanks Leo,

I used the second snippet and added the ! operator since I need it excluded from all but the blog page and it worked.

Thanks for the fast response.

No problem :)

This archived topic is closed to new replies.