One potential approach isn't so much "hiding" a sidebar as it is not including it.
Pages
Every page in your site can use a different template. Usually, you'll just create a template that uses the default ("Default Template") that includes the header, footer, content, sidebar(s) as you'd normally expect. However, you can create a new page template for your site that follows the same formatting, but omits the sidebar.
Alternatively, if you you know the ID or slug of the page in question, you can create a page template just for that pace. Just place one of the following files on your theme:
- page-{id}.php
- page-{slug}.php
WordPress will load it by default.
Posts
For posts, tho, WordPress doesn't support this kind of hierarchy. You can get around it by creating a custom post type, then creating single-{post-type}.php
to display that post type without a sidebar, but that might not be what you want.
However, if your theme is applying appropriate body classes, then you can filter based on the post ID once again and use CSS to hide things. When properly using body_class()
in your theme, the class postid-{post-id}
will be applied to the body. You can use this to your advantage.
/* ... All of your other CSS rules */
body.postid-15 .sidebar {
display: none;
}
The downside with this approach is that the sidebar markup is still loaded, it's just hidden with CSS. But for now (until WordPress implements a per-post template similar to the per-page one it already has), this should be enough to get you started.