Site logo

Archived topic

Filter hook for Content Container option?

3 replies · Started by Ash on January 7, 2023

Viewing posts 1–4 of 4

I want to use filter hook to change the Content Container option (fullwith/contained) conditionally.
But I could not find it in the documentation.

This can not be done with the Elements or css since the condition is tricky, need php.

Hi there,

the Layout Element or the Layout Metabox simply adds the relevant class to the <body> tag using the core body_class filter.

The classes are: full-width-content and contained-content

Heres an example of the filter:

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

    return $classes;
} );

Thank you.

You're welcome

This archived topic is closed to new replies.