I’d like to hide the sidebar on a specific post (not page). How can I do this?
For background, I’ve searched quite a bit both on Google and here. I’m finding lots of solutions for showing different sidebars on posts vs. pages, or for showing (or hiding) a specific sidebar on a specific page, but nothing that’s about hiding the sidebar from a single specific post.
7 Answers
Here’s an idea I mentioned on Twitter.
function special_post_template( $template ) {
// Identify a single query for the special post
if ( is_single() && 10 == get_the_ID() )
$template = get_template_directory() . '/special-single.php';
return $template;
}
add_filter( 'template_include', 'special_post_template' );