Site logo

Archived topic

Full width page default

5 replies · Started by Jason Westbrook on April 8, 2017

Viewing posts 1–6 of 6

Is it possible to auto set pages to be full-width globally without having to select it as an option on each page

You could add a function like this:

add_filter( 'body_class','tu_add_body_class' );
function tu_add_body_class( $classes ) {
    if ( is_page() ) {
        $classes[] = 'full-width-content';
    }

    return $classes;
}

Hi Tom,

Is there a way to customize this code to include posts as well?

Thanks a lot

Hi there,

like this:

add_filter( 'body_class','tu_add_body_class' );
function tu_add_body_class( $classes ) {
    if ( is_page() || is_single() ) {
        $classes[] = 'full-width-content';
    }

    return $classes;
}

GP 1.7 is close to beta release where this becomes super simple ;)

Hi David,

Thanks! Good to know :)

Glad to be of help.

This archived topic is closed to new replies.