block editor – Creative way of applying either CSS or a custom class to specific pages

Question

I’m working on WordPress 5.8
If I have a page in edit mode, is there a way I can add a button on the right side column to be disabled or enabled?

That button will determine if that page should have the following CSS applied to it.

@media screen and (min-width: 1000px) {
    html body .my-custom-page-wrapper {
        display:flex;
        max-width:initial!important;
    }
}

Wanting this to be an option available for any post or page. Is this possible to setup without headache?

Or can I use custom fields, to add a css class to the page body element? The idea is that the non-technical editor can add the text “wide” onto the custom field. Then update the page and see that its wider due to having that class on the body element.

Just trying to use as much as I can OOTB without having to create an additional page template with custom classes on it. Thats all!

Many thanks!

0
klewis 2 weeks 2021-11-17T15:48:37-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse