Hide sidebar on a select category

Hi,

Would someone know how I can hide the Sidebar when a posting of select categories is open?
I would show it by default, but not for posts in that category. For example, in the category “Start”.

1 Like

I’d quite like to do that too.

This CSS should do that nicely.

Just fill in this field with your category slug and copy the code. Then drop it in the Desktop CSS of your Theme and voila!


(If you are targeting a subcategory, use a parentslug-subcatslug format)

// hides sidebar for the specified category
body.has-sidebar-page.category-=CategorySlug= {
    #main-outlet-wrapper {
        grid-template-columns: 0 minmax(0, 1fr);
        gap: 0;
        padding-left: 10px;
     }
     .wrap {
       max-width: var(--d-max-width);
     }
}

@Lilly - would this work as a feature of Navigation (sidebar) menu display control?

8 Likes

Very helpful, I have just tested it. Thank you!

Is it possible to also hide it on /tags ? body.has-sidebar-page.tags isn’t the right selector.

It certainly would. will add it to the component. Thank you for the suggestion and the code :slight_smile:

3 Likes

If you inspect the classes in the tag of the page you are trying to target, then you will see the class that you need to use.

In this case, body.has-sidebar-page.tags-page should sort you out.

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.