Site logo

Archived topic

Back to top button for one page only

3 replies · Started by George on May 25, 2019

Viewing posts 1–4 of 4

I want to have the back to top button for one page only. I activate the back to top button from the Customizer and then add this class:

body:not(.page-id-1259 a.generate-back-to-top) {
	display: none;
}

It doesn't work, though. Adding the !important rule doesn't make any difference either.

Is there a more elegant solution?

Yes Leo, perfect!

With the button disabled in the Customizer:

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;
}

I knew there was a solution for that, like always!

Cheers!

Every option in the customizer should be filter-able :)

This archived topic is closed to new replies.